Avoid fatal PHP error due to deprecation-warnings during autoloading.

Due to a PHP bug combined with deprecation-warnings from the OpenID
library, we may fail with a fatal error due to not finding the
SimpleSAML_Logger class.

See PHP bug: https://bugs.php.net/bug.php?id=47987

git-svn-id: http://simplesamlphp.googlecode.com/svn/trunk@2999 44740490-163a-0410-bde0-09ae8108e29a
This commit is contained in:
olavmrk 2011-12-08 13:56:41 +00:00
parent 2455b5c775
commit 6d367edbe8
1 changed files with 11 additions and 0 deletions

View File

@ -43,6 +43,17 @@ set_exception_handler('SimpleSAML_exception_handler');
/* Log full backtrace on errors and warnings. */
function SimpleSAML_error_handler($errno, $errstr, $errfile = NULL, $errline = 0, $errcontext = NULL) {
if (!class_exists('SimpleSAML_Logger')) {
/* We are probably logging a deprecation-warning during parsing.
* Unfortunately, the autoloader is disabled at this point,
* so we should stop here.
*
* See PHP bug: https://bugs.php.net/bug.php?id=47987
*/
return FALSE;
}
if ($errno & SimpleSAML_Utilities::$logMask) {
/* Masked error. */
return FALSE;