From:             david dot lamparter at t-online dot de
Operating system: Linux
PHP version:      4.3.2
PHP Bug Type:     Arrays related
Bug description:  \0 (null byte) in array key leads to truncation

Description:
------------
(This Bug is the same as #14580 [Closed])

Using null bytes in array keys doesn't work correctly, the key gets cut
off at the null byte. (normal strings work, and array values work, too)

I'm updating to 4.3.3-RC1 right now; if it doesn't work there too, i'll
try 5.0.0-Beta1

!!!!!!!!!!!!!!!!!!!!
Bug #14580 says this should be fixed, but it isn't (at least in
4.3.2-RC2); therefore I'm re-posting this

--------------------
System Information:

Apache 2.0.46 running on Linux 2.4.20, LFS system
glibc 2.3.1, gcc 3.2.2

First block from phpinfo():

PHP Version 4.3.2-RC2 

System  Linux charon 2.4.20-eq1-cx #4 Mit Jan 29 16:07:00 CET 2003 i686  
Build Date  May 12 2003 14:43:04  
Configure Command  './configure' '--prefix=/opt/apache_2.0.45'
'--with-apxs2=/opt/apache_2.0.45/bin/apxs' '--enable-bcmath'
'--enable-calendar' '--enable-ftp' '--enable-mbstring' '--enable-mbregex'
'--enable-sockets' '--enable-xslt' '--with-openssl' '--with-zlib'
'--with-bz2' '--with-dom' '--with-dom-xslt' '--with-dom-exslt'
'--with-mysql=/usr/local/mysql' '--with-xslt-sablot' '--with-snmp'
'--with-imap=/usr' '--with-gd=/usr' '--with-png-dir=/usr'
'--with-jpeg-dir=/usr' '--with-freetype-dir=/usr' '--with-ldap'
'--with-gmp' '--with-iconv' '--with-xmlrpc'
'--with-db3=/usr/local/BerkeleyDB.3.3' '--enable-shmop'  
Server API  Apache 2.0 Handler  
Virtual Directory Support  disabled  
Configuration File (php.ini) Path  /opt/apache_2.0.45/lib  
PHP API  20020918  
PHP Extension  20020429  
Zend Extension  20021010  
Debug Build  no  
Thread Safety  disabled  
Registered PHP Streams  php, http, ftp, https, ftps, compress.bzip2,
compress.zlib  


Reproduce code:
---------------
<?
        $text = "abcd\0efgh";
        echo strlen ($text) . ": $text\n";

        $ar = array ("abcd\0efgh" => "value\0works");
        foreach ($ar as $key => $val)
                echo strlen ($key) . ": $key => " . strlen ($val) . ": $val\n";


Expected result:
----------------
9: abcdefgh
9: abcdefgh => 11: valueworks


Actual result:
--------------
9: abcdefgh
4: abcd => 11: valueworks


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

Reply via email to