Bug #14580: Incorrect behavior with key containing NULL byte
| From: | jlpriou at coleebris dot com | Date: | Tue, 18 Dec 2001 15:32:37 +0000 |
| Subject: | Bug #14580: Incorrect behavior with key containing NULL byte | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-74259@lists.php.net to get a copy of this message | ||
From: jlpriou@coleebris.com
Operating system: Linux
PHP version: 4.1.0
PHP Bug Type: Arrays related
Bug description: Incorrect behavior with key containing NULL byte
We are trying using array wich contain as key a binary value.
We have no problem when storing this key and value in the array,
but when we want to get the key, the key is truncated !
Tested with Php 4.0.6 and 4.1.0
<?
$key = "string\0withnull";
echo "strlen(" . urlencode($key) . ") = " . strlen($key) .
"<br>";
$a = array($key => "val");
echo $a[$key] . "<br>"; // Result is correct
reset($a) ;
echo (key($a) == $key) ? "equal" : "not equal" ; // part of the key is
lost
echo "(" . urlencode(key($a)) ." == ". urlencode($key) .")" ;
?>
--
Edit bug report at: http://bugs.php.net/?id=14580&edit=1