Date: 12/19/99
- Next message: Lars Torben Wilson: "Re: [PHP-DEV] ./configure and docs"
- Previous message: Shane Owenby: "[PHP-DEV] ./configure and docs"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
From: old.wolf <email protected>
Operating system: RedHat Linux 6.1 i486 Apache 1.3.9+BenSSL1.3.7
PHP version: 3.0.12
PHP Bug Type: Misbehaving function
Bug description: implode() garbages when string contains NUL
When implode() is called with an array which contains a string which contains NUL ie. chr(0), the output of implode() contains garbage, from the point where the NUL ought to have occurred, onwards. The following code demonstrates this.
<?php
$buggy_string = "this bit is ok" . chr(0) . "garbagegarbagegarbage";
$ok_array = array("hello", $buggy_string);
$msg_fields = implode("|", $ok_array);
echo "buggy_string is <B>$buggy_string</B>.<BR>\n";
echo "members of array are:<B> ";
while (list($z, $member) = each($ok_array))
echo $member . ", ";
echo "</B><BR>\n";
echo "imploded array is <B>$msg_fields</B>.<BR>\n";
?>
This program's output differs with each execution, an example is:
buggy_string is this bit is okgarbagegarbagegarbage.
members of array are: hello, this bit is okgarbagegarbagegarbage,
imploded array is hello|this bit is ok>+SELFhello|this.
My configure-string was:
./configure --with-apache=/usr/local/src/apache_1.3.9 --enable-track-vars --with-mcrypt=/usr/local/libmcrypt --with-mhash=/usr/local/mhash --with-mysql=/usr/local/mysql
-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Lars Torben Wilson: "Re: [PHP-DEV] ./configure and docs"
- Previous message: Shane Owenby: "[PHP-DEV] ./configure and docs"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

