diff --git a/src/Subfission/Cas/CasManager.php b/src/Subfission/Cas/CasManager.php index ad060ca..b17446e 100644 --- a/src/Subfission/Cas/CasManager.php +++ b/src/Subfission/Cas/CasManager.php @@ -75,12 +75,13 @@ protected function configureCas( $method = 'client' ) { $server_type = SAML_VERSION_1_1; } else { // This allows the user to use 1.0, 2.0, etc as a string in the config - $cas_ver = 'CAS_VERSION_' . str_replace( '.', '_', - $this->config['cas_version'] ); - if ( defined( $cas_ver ) ) { - // We pull the phpCAS constant values as this is their definition - $server_type = constant($cas_ver); - } else { + $cas_version_str = 'CAS_VERSION_' . str_replace( '.', '_', $this->config['cas_version'] ); + + // We pull the phpCAS constant values as this is their definition + // PHP will generate a E_WARNING if the version string is invalid which is helpful for troubleshooting + $server_type = constant($cas_version_str); + + if ( is_null($server_type) ) { // This will never be null, but can be invalid values for which we need to detect and substitute. phpCAS::log( 'Invalid CAS version set; Reverting to defaults' ); $server_type = CAS_VERSION_2_0;