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

From: Date: Thu, 04 Jul 2002 01:03:37 +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-13056@lists.php.net to get a copy of this message
ID: 14580 Updated by: eru@php.net Reported By: jlpriou@coleebris.com -Status: Open +Status: Verified Bug Type: Arrays related Operating System: Linux -PHP Version: 4.1.0 +PHP Version: 4.3.0-dev New Comment: Seems to fail only with \0 every other escape-sequence works fine. Previous Comments: ------------------------------------------------------------------------ [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 (#13056) next »