Bug #14580 Updated: Incorrect behavior with key containing NULL byte

From: Date: Mon, 08 Jul 2002 07:02:16 +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-13486@lists.php.net to get a copy of this message
ID: 14580 Updated by: derick@php.net Reported By: jlpriou@coleebris.com -Status: Verified +Status: Closed -Bug Type: Scripting Engine problem +Bug Type: Arrays related Operating System: Linux PHP Version: 4.3.0-dev New Comment: This bug has been fixed in CVS. You can grab a snapshot of the CVS version at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. Derick 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

« previous php.bugs (#13486) next »