Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP 8 support #248

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"php": ">=5.5.0",
"ext-openssl": "*",
"illuminate/support": ">=5.0.0",
"onelogin/php-saml": "^3.0.0"
"onelogin/php-saml": "^4.0"
},
"require-dev": {
"mockery/mockery": "0.9.*",
Expand Down
12 changes: 8 additions & 4 deletions src/Aacotroneo/Saml2/Saml2Auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function __construct(OneLogin_Saml2_Auth $auth)
/**
* Load the IDP config file and construct a OneLogin\Saml2\Auth (aliased here as OneLogin_Saml2_Auth).
* Pass the returned value to the Saml2Auth constructor.
*
*
* @param string $idpName The target IDP name, must correspond to config file 'config/saml2/${idpName}_idp_settings.php'
* @return OneLogin_Saml2_Auth Contructed OneLogin Saml2 configuration of the requested IDP
* @throws \InvalidArgumentException if $idpName is empty
Expand Down Expand Up @@ -224,14 +224,16 @@ function getLastErrorReason() {
return $this->auth->getLastErrorReason();
}


protected static function extractPkeyFromFile($path) {
$res = openssl_get_privatekey($path);
if (empty($res)) {
throw new \Exception('Could not read private key-file at path \'' . $path . '\'');
}
openssl_pkey_export($res, $pkey);
openssl_pkey_free($res);
if (PHP_MAJOR_VERSION < 8) {
openssl_pkey_free($res);
}
return static::extractOpensslString($pkey, 'PRIVATE KEY');
}

Expand All @@ -241,7 +243,9 @@ protected static function extractCertFromFile($path) {
throw new \Exception('Could not read X509 certificate-file at path \'' . $path . '\'');
}
openssl_x509_export($res, $cert);
openssl_x509_free($res);
if (PHP_MAJOR_VERSION < 8) {
openssl_x509_free($res);
}
return static::extractOpensslString($cert, 'CERTIFICATE');
}

Expand Down