Open mikeselander opened 6 years ago
This seems to throw a fatal error on PHP 8 now.
A temporary workaround, until it gets properly fixed, could be to utilize wpsimplesaml_idp_metadata_xml
and pass an empty XML, if the field is empty:
/**
* Sanitize the SSO IDP metadata.
* Checks if the `ssoidp_metadata` option is empty, and if so, returns an empty XML string, to prevent a fatal error on PHP 8.
*
* @return string
*/
function sanitize_sso_idp_metadata(): string {
$sso_metadata = get_option( 'sso_idp_metadata' );
if ( empty( $sso_metadata ) ) {
return '<empty/>';
}
return $sso_metadata;
}
add_filter( 'wpsimplesaml_idp_metadata_xml', 'sanitize_sso_idp_metadata' );
It appears that we're passing an empty string if there is no XML file to pass to the PHP-SAML library. This is spilling PHP warnings.
Stack trace: