#20865 [Opn]: array_key_exists(NULL, $myarray) generates warning and returns FALSE;
| From: | grubby_d at yahoo dot com | Date: | Fri, 06 Dec 2002 17:16:54 +0000 |
| Subject: | #20865 [Opn]: array_key_exists(NULL, $myarray) generates warning and returns FALSE; | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-26864@lists.php.net to get a copy of this message | ||
ID: 20865
User updated by: grubby_d@yahoo.com
Reported By: grubby_d@yahoo.com
Status: Open
Bug Type: Unknown/Other Function
Operating System: XP/IIS
PHP Version: 4.2.3
New Comment:
this is an self explanatory bug.
RUN THIS SCRIPT
<?php
$myarray = array(1, 2, 3);
$myarray[NULL] = "the null value";
print_r($myarray); //output includes [] => "the null value"
// can reference the null indexed value without problems
//The bug is in this function:
if (array_key_exists(NULL, $myarray))
{
echo "you won't see this output<BR>\n";
}
//generates warning and returns FALSE
?>
I found the bug on redhat 7.3/apache.1.3.x with PHP verison 4.1.X but
i
reproduced the same behaviour on the submitted platform (PHP4.2.3) to
comply with this bug report form.
Previous Comments:
------------------------------------------------------------------------
[2002-12-06 11:14:21] grubby_d@yahoo.com
this is an self explanatory bug.
RUN THIS SCRIPT
<?php
$myarray = array(1, 2, 3);
$myarray[NULL] = "the null value";
print_r($myarray); //output includes [] => "the null value"
// can reference the null indexed value without problems
//The bug is in this function:
$result = array_key_exists(NULL, $myarray) //generates warning and
returns FALSE;
?>
I found the bug on redhat 7.3/apache.1.3.x with PHP verison 4.1.X but i
reproduced the same behaviour on the submitted platform (PHP4.2.3) to
comply with this bug report form.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=20865&edit=1