Bug #14580 Updated: Incorrect behavior with key containing NULL byte
| From: | sniper@php.net | Date: | Mon, 08 Jul 2002 01:36:09 +0000 |
| Subject: | Bug #14580 Updated: Incorrect behavior with key containing NULL byte | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-13457@lists.php.net to get a copy of this message | ||
ID: 14580
Updated by: sniper@php.net
Reported By: jlpriou@coleebris.com
Status: Verified
-Bug Type: Arrays related
+Bug Type: Scripting Engine problem
Operating System: Linux
PHP Version: 4.3.0-dev
Previous Comments:
------------------------------------------------------------------------
[2002-07-03 21:03:37] eru@php.net
Seems to fail only with \0 every other escape-sequence works fine.
------------------------------------------------------------------------
[2001-12-18 10:32:36] jlpriou@coleebris.com
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 this bug report at http://bugs.php.net/?id=14580&edit=1