diff options
author | Josh Hoyt <josh@janrain.com> | 2006-01-04 22:59:13 +0000 |
---|---|---|
committer | Josh Hoyt <josh@janrain.com> | 2006-01-04 22:59:13 +0000 |
commit | 48ce37bd79db6ab697f73153ea875c63f6a59d4b (patch) | |
tree | 3f4add9d0e039498d135770b478934b861bc3b22 /Tests/TestDriver.php | |
parent | 8f0604f92487e389339507d1df3403aeffc41a03 (diff) | |
download | php-openid-48ce37bd79db6ab697f73153ea875c63f6a59d4b.zip php-openid-48ce37bd79db6ab697f73153ea875c63f6a59d4b.tar.gz php-openid-48ce37bd79db6ab697f73153ea875c63f6a59d4b.tar.bz2 |
[project @ Added PHP 5 compatibility to test driver]
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'); |