diff options
Diffstat (limited to 'Tests/TestDriver.php')
-rw-r--r-- | Tests/TestDriver.php | 49 |
1 files changed, 48 insertions, 1 deletions
diff --git a/Tests/TestDriver.php b/Tests/TestDriver.php index a548f94..4205d63 100644 --- a/Tests/TestDriver.php +++ b/Tests/TestDriver.php @@ -1,6 +1,53 @@ <?php -error_reporting(E_STRICT | E_ALL); +if (defined('E_STRICT')) { + // PHP 5 + $_Net_OpenID_allowed_deprecation = + array('var', + 'is_a()' + ); + + function ignoreDeprecation($errno, $errstr, $errfile, $errline) { + // Handle http://bugs.php.net/bug.php?id=32428 + // Augment this + // regular expression if the bug exists in another version. + if (preg_match('/^5\.1\.1$/', phpversion()) && $errno == 2) { + $allowed_files = array(array('/Net/OpenID/CryptUtil.php', + 'xxx'), + array('/Net/OpenID/OIDUtil.php', + 'parse_url')); + + foreach ($allowed_files as $entry) { + list($afile, $msg) = $entry; + $slen = strlen($afile); + $slice = substr($errfile, strlen($errfile) - $slen, $slen); + if ($slice == $afile && strpos($errstr, $msg) == 0) { + // Ignore this error + return; + } + } + } + + global $_Net_OpenID_allowed_deprecation; + + switch ($errno) { + case E_STRICT: + // XXX: limit this to files we know about + foreach ($_Net_OpenID_allowed_deprecation as $depr) { + if (strpos($errstr, "$depr: Deprecated.") !== false) { + return; + } + } + default: + error_log("$errfile:$errline - $errno: $errstr"); + } + } + + set_error_handler('ignoreDeprecation'); + error_reporting(E_STRICT | E_ALL); +} else { + error_reporting(E_ALL); +} require_once('PHPUnit.php'); require_once('PHPUnit/GUI/HTML.php'); |