From:             [EMAIL PROTECTED]
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


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to