Bug #79803 [NEW]: array_key_exists not returning bool

From: Date: Tue, 07 Jul 2020 09:52:00 +0000
Subject: Bug #79803 [NEW]: array_key_exists not returning bool
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-227846@lists.php.net to get a copy of this message
From: marekvikartovsky at gmail dot com Operating system: PHP version: Irrelevant Package: Arrays related Bug Type: Bug Bug description:array_key_exists not returning bool Description: ------------ --- From manual page: https://php.net/function.array-key-exists --- Hello, if I am calling array_key_exists on NULL by mistake, the function should return bool FALSE, not NULL. I understand that it shows me a warning, but it also should return bool value as in documentation. I tested it on PHP version 7.1.33 and 7.4.7 Test script: --------------- var_dump(array_key_exists('test', NULL)); Expected result: ---------------- By documentation I am expecting to return a bool value, not NULL or you should return an exception, not warning. -- Edit bug report at https://bugs.php.net/bug.php?id=79803&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=79803&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=79803&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=79803&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=79803&r=needscript Try newer version: https://bugs.php.net/fix.php?id=79803&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=79803&r=support Expected behavior: https://bugs.php.net/fix.php?id=79803&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=79803&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=79803&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=79803&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=79803&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=79803&r=dst IIS Stability: https://bugs.php.net/fix.php?id=79803&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=79803&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=79803&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=79803&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=79803&r=mysqlcfg

« previous php.bugs (#227846) next »