Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Never reference E_STRICT on PHP 8.4+ #145

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion PEAR/RunTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 6 additions & 1 deletion make-gopear-phar.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
7 changes: 6 additions & 1 deletion make-installpear-nozlib-phar.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
6 changes: 4 additions & 2 deletions scripts/pearcmd.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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",
Expand All @@ -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)) {
Expand Down
4 changes: 2 additions & 2 deletions tests/PEAR_Error/pear_error.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ 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')) {
define('E_DEPRECATED', -1);
}

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) {
Expand Down