Skip to content

Commit

Permalink
Fixes ADOdb#981 for all error handlers in ADOdb 5.22x
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanGibbs3 committed Jun 11, 2023
1 parent 943ac8a commit 0bae872
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
9 changes: 8 additions & 1 deletion adodb-errorhandler.inc.php
Expand Up @@ -37,7 +37,14 @@
*/
function ADODB_Error_Handler($dbms, $fn, $errno, $errmsg, $p1, $p2, &$thisConnection)
{
if (error_reporting() == 0) return; // obey @ protocol
// Do not throw if errors are suppressed by @ operator
// error_reporting() value for suppressed errors changed in PHP 8.0.0
$suppressed = version_compare(PHP_VERSION, '8.0.0', '<')
? 0
: E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR | E_RECOVERABLE_ERROR | E_PARSE;
if (error_reporting() == $suppressed) {
return;
}
switch($fn) {
case 'EXECUTE':
$sql = $p1;
Expand Down
10 changes: 9 additions & 1 deletion adodb-errorpear.inc.php
Expand Up @@ -52,7 +52,15 @@ function ADODB_Error_PEAR($dbms, $fn, $errno, $errmsg, $p1=false, $p2=false)
{
global $ADODB_Last_PEAR_Error;

if (error_reporting() == 0) return; // obey @ protocol
// Do not throw if errors are suppressed by @ operator
// error_reporting() value for suppressed errors changed in PHP 8.0.0
$suppressed = version_compare(PHP_VERSION, '8.0.0', '<')
? 0
: E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR | E_RECOVERABLE_ERROR | E_PARSE;
if (error_reporting() == $suppressed) {
return;
}

switch($fn) {
case 'EXECUTE':
$sql = $p1;
Expand Down

0 comments on commit 0bae872

Please sign in to comment.