Skip to content

Commit

Permalink
Cleaned up fix for better readability and removed unnecessary code.
Browse files Browse the repository at this point in the history
  • Loading branch information
Zach Jetson authored and subfission committed Oct 9, 2017
1 parent 5a620e2 commit 8f8ecf7
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/Subfission/Cas/CasManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 8f8ecf7

Please sign in to comment.