Skip to content

Commit

Permalink
Merge pull request phpbb#6710 from marc1706/ticket/17384
Browse files Browse the repository at this point in the history
[ticket/17384] Stop overriding error handler in test case
  • Loading branch information
marc1706 committed Aug 31, 2024
2 parents dc0561c + 92730af commit 57f86c0
Showing 1 changed file with 0 additions and 29 deletions.
29 changes: 0 additions & 29 deletions tests/test_framework/phpbb_test_case.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ public function __construct($name = NULL, array $data = array(), $dataName = '')
'phpbb_database_test_case' => ['already_connected', 'last_post_timestamp'],
];
$this->excludeBackupStaticAttributes($backupStaticAttributesBlacklist);

set_error_handler([$this, 'trigger_error_callback']);
}

public function get_test_case_helpers()
Expand Down Expand Up @@ -137,31 +135,4 @@ public static function assertFileNotExists(string $filename, string $message = '
parent::assertFileNotExists($filename, $message);
}
}

/**
* Passing E_USER_ERROR to trigger_error() is deprecated as of PHP 8.4, so it causes E_DEPRECATED
* Use trigger_error() callback function to workaround this by handling E_USER_ERROR and suppressing E_DEPRECATED
* "Passing E_USER_ERROR to trigger_error() is deprecated since 8.4, throw an exception or call exit with a string message instead"
*
*/
public function trigger_error_callback($errno, $errstr, $errfile, $errline)
{
// $errstr may need to be escaped
$errstr = htmlspecialchars($errstr);

switch ($errno) {
case E_USER_ERROR:
echo $errstr;
exit();
break;

case E_DEPRECATED:
return true;
break;

default:
return false;
break;
}
}
}

0 comments on commit 57f86c0

Please sign in to comment.