diff --git a/PEAR/RunTest.php b/PEAR/RunTest.php index 3965832b5..dd5bb1c34 100644 --- a/PEAR/RunTest.php +++ b/PEAR/RunTest.php @@ -88,7 +88,11 @@ function __construct($logger = null, $options = array()) if (!defined('E_STRICT')) { define('E_STRICT', 0); } - $this->ini_overwrites[] = 'error_reporting=' . (E_ALL & ~(E_DEPRECATED | E_STRICT)); + $excluded_error_reporting = E_DEPRECATED; + if (!defined('PHP_VERSION_ID') || PHP_VERSION_ID < 80400) { + $excluded_error_reporting |= E_STRICT; + } + $this->ini_overwrites[] = 'error_reporting=' . (E_ALL & ~$excluded_error_reporting); if (is_null($logger)) { require_once 'PEAR/Common.php'; $logger = new PEAR_Common; diff --git a/make-gopear-phar.php b/make-gopear-phar.php index 5e83c69ae..d05f0be77 100644 --- a/make-gopear-phar.php +++ b/make-gopear-phar.php @@ -22,7 +22,12 @@ * @copyright 2005-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License */ -error_reporting(error_reporting() & ~E_STRICT & ~E_DEPRECATED); +$new_error_reporting = error_reporting() & ~E_DEPRECATED; +if (!defined('PHP_VERSION_ID') || PHP_VERSION_ID < 80400) { + $new_error_reporting &= ~E_STRICT; +} +error_reporting($new_error_reporting); +unset($new_error_reporting); function replaceVersion($contents, $path) { diff --git a/make-installpear-nozlib-phar.php b/make-installpear-nozlib-phar.php index a79e02aa1..500728fa4 100644 --- a/make-installpear-nozlib-phar.php +++ b/make-installpear-nozlib-phar.php @@ -22,7 +22,12 @@ * @copyright 2005-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License */ -error_reporting(error_reporting() & ~E_STRICT & ~E_DEPRECATED); +$new_error_reporting = error_reporting() & ~E_DEPRECATED; +if (!defined('PHP_VERSION_ID') || PHP_VERSION_ID < 80400) { + $new_error_reporting &= ~E_STRICT; +} +error_reporting($new_error_reporting); +unset($new_error_reporting); function replaceVersion($contents, $path) { diff --git a/scripts/pearcmd.php b/scripts/pearcmd.php index e3606aa9d..290435333 100644 --- a/scripts/pearcmd.php +++ b/scripts/pearcmd.php @@ -438,7 +438,7 @@ function cmdHelp($command) */ function error_handler($errno, $errmsg, $file, $line) { - if ($errno & E_STRICT) { + if ((!defined('PHP_VERSION_ID') || PHP_VERSION_ID < 80400) && ($errno & E_STRICT)) { return; // E_STRICT } if ($errno & E_DEPRECATED) { @@ -455,7 +455,6 @@ function error_handler($errno, $errmsg, $file, $line) E_ERROR => "Error", E_WARNING => "Warning", E_PARSE => "Parsing Error", - E_STRICT => 'Strict Warning', E_NOTICE => "Notice", E_CORE_ERROR => "Core Error", E_CORE_WARNING => "Core Warning", @@ -465,6 +464,9 @@ function error_handler($errno, $errmsg, $file, $line) E_USER_WARNING => "User Warning", E_USER_NOTICE => "User Notice" ); + if (!defined('PHP_VERSION_ID') || PHP_VERSION_ID < 80400) { + $errortype[E_STRICT] = 'Strict Warning'; + } $prefix = $errortype[$errno]; global $_PEAR_PHPDIR; if (stristr($file, $_PEAR_PHPDIR)) { diff --git a/tests/PEAR_Error/pear_error.phpt b/tests/PEAR_Error/pear_error.phpt index 11a20f719..e5e891195 100644 --- a/tests/PEAR_Error/pear_error.phpt +++ b/tests/PEAR_Error/pear_error.phpt @@ -15,7 +15,7 @@ if (!getenv('PHP_PEAR_RUNTESTS')) { include_once "PEAR.php"; -if (!defined('E_STRICT')) { +if ((!defined('PHP_VERSION_ID') || PHP_VERSION_ID < 80400) && !defined('E_STRICT')) { define('E_STRICT', -1); } if (!defined('E_DEPRECATED')) { @@ -23,7 +23,7 @@ if (!defined('E_DEPRECATED')) { } function test_error_handler($errno, $errmsg, $file, $line) { - if ($errno == E_STRICT) { + if ((!defined('PHP_VERSION_ID') || PHP_VERSION_ID < 80400) && $errno == E_STRICT) { return; } if ($errno == E_DEPRECATED) {