From:             risearch at risearch dot org
Operating system: FreeBSD
PHP version:      Irrelevant
PHP Bug Type:     Arrays related
Bug description:  Arrays and string keya starting with "\x00" character.

Description:
------------
I use PHP on WinXP and Linux box. Older versions had bug with array keys
starting wuth "\x00" character. Now there is no such bug on my computers
(WinXP/Apache/php-4.3.4-Win32 & php-4.3.6-Win32 or Linux/Apache 1.3.29/PHP
4.3.4), but some of the script's users complain that script works on
Windows box but does not on server. So, I guess that some of the versions
still have this bug (like MacOSX/Apache/PHP4.3.2 or BSD/Apache/PHP4.3.4,
as reported by users). 

Reproduce code:
---------------
$key = "\x00\x00";
$arr[$key] = 1;
$key = "\x00\x44";
$arr[$key] = 2;
$key = "\x44\x44";
$arr[$key] = 3;


$fp = fopen("test","wb");
foreach ($arr as $k => $v) {
fwrite($fp,"'$k' => $v\n");
}


Expected result:
----------------
'\x00\x00' => 1
'\x00D' => 2
'DD' => 3

/* instead of "\x00" zero-character should be written to file */

Actual result:
--------------
'' => 1
'' => 2
'DD' => 3

-- 
Edit bug report at http://bugs.php.net/?id=28351&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=28351&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=28351&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=28351&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=28351&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=28351&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=28351&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=28351&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=28351&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=28351&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=28351&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=28351&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=28351&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28351&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=28351&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=28351&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=28351&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=28351&r=float

Reply via email to