Bug #79803 [Opn->Nab]: array_key_exists not returning bool
| From: | cmb@php.net | Date: | Tue, 07 Jul 2020 10:06:09 +0000 |
| Subject: | Bug #79803 [Opn->Nab]: array_key_exists not returning bool | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-227849@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=79803&edit=1
ID: 79803
Updated by: cmb@php.net
Reported by: marekvikartovsky at gmail dot com
Summary: array_key_exists not returning bool
-Status: Open
+Status: Not a bug
Type: Bug
Package: Arrays related
PHP Version: Irrelevant
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
<https://www.php.net/manual/en/functions.internal.php>
Previous Comments:
------------------------------------------------------------------------
[2020-07-07 09:52:00] marekvikartovsky at gmail dot com
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 this bug report at https://bugs.php.net/bug.php?id=79803&edit=1