]> git.joonet.de Git - adminer.git/commitdiff
Mute the same error in PHP 5
authorJakub Vrana <jakub@vrana.cz>
Mon, 24 Mar 2025 06:25:17 +0000 (07:25 +0100)
committerJakub Vrana <jakub@vrana.cz>
Mon, 24 Mar 2025 06:30:22 +0000 (07:30 +0100)
adminer/include/errors.inc.php

index d9cc99fd43b3966abeb54abd35de11cb2eaba009..ac7c54c0adf9695125a66d177ae44590d191df54 100644 (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