Bug #70500 [Wfx->Csd]: array_keys() returns NULL
| From: | miloslav dot hula at gmail dot com | Date: | Tue, 15 Sep 2015 11:57:02 +0000 |
| Subject: | Bug #70500 [Wfx->Csd]: array_keys() returns NULL | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-12754@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=70500&edit=1
ID: 70500
User updated by: miloslav dot hula at gmail dot com
Reported by: miloslav dot hula at gmail dot com
Summary: array_keys() returns NULL
-Status: Wont fix
+Status: Closed
Type: Bug
Package: Documentation problem
PHP Version: 7.0.0RC2
Block user comment: N
Private report: N
New Comment:
From doc:
> In this case it will likely return NULL but this is just a convention, and cannot be relied
> upon.
Previous Comments:
------------------------------------------------------------------------
[2015-09-15 11:51:43] requinix@php.net
Standard practice for internal functions is to return NULL when passed arguments of the wrong type.
Documenting this on every single function page would be crazy so it's mentioned on the internal
functions page instead.
http://php.net/functions.internal
------------------------------------------------------------------------
[2015-09-15 10:07:04] miloslav dot hula at gmail dot com
Generally returns NULL on anything else than array.
------------------------------------------------------------------------
[2015-09-15 10:03:38] miloslav dot hula at gmail dot com
Description:
------------
The array_keys() returns NULL when called with NULL instead of array.
Test script:
---------------
<?php
var_dump(array_keys(NULL));
Expected result:
----------------
array(0) {
}
Actual result:
--------------
NULL
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=70500&edit=1