1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-07 15:16:44 +02:00

Mute the same error in PHP 5

This commit is contained in:
Jakub Vrana
2025-03-24 07:25:17 +01:00
parent 60555c5736
commit 9fd9a1fc8d

View File

@@ -3,5 +3,8 @@ namespace Adminer;
error_reporting(24575); // all but E_DEPRECATED (overriding mysqli methods without types is deprecated)
set_error_handler(function ($errno, $errstr) {
return !!preg_match('~^(Trying to access array offset on( value of type)? null|Undefined array key)~', $errstr);
// "offset on null" mutes $_GET["fields"][0] if there's no ?fields[]= (62017e3 is a wrong fix for this)
// "Undefined array key" mutes $_GET["q"] if there's no ?q=
// "Undefined offset" and "Undefined index" are older messages for the same thing
return !!preg_match('~^(Trying to access array offset on( value of type)? null|Undefined (array key|offset|index))~', $errstr);
}, E_WARNING | E_NOTICE); // warning since PHP 8.0