PHP 4.0 Bug #1932: implode() changes array contents
| From: | alan at gocdo dot net dot au | Date: | Fri, 30 Jul 1999 18:10:45 +0000 |
| Subject: | PHP 4.0 Bug #1932: implode() changes array contents | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-9355@lists.php.net to get a copy of this message | ||
From: alan@gocdo.net.au
Operating system: Red Hat 5.2
PHP version: 4.0 Latest CVS (30/07/1999)
PHP Bug Type: Misbehaving function
Bug description: implode() changes array contents
Complied as cgi binary.
When implode is passed an array with an element that contains an array the contents of the contained
array is lost.. eg.
<?php
$tmp= array ( array( "x"=>"first_item",
"y"=>"second_Item",
"z"=>"third_item"
)
);
$cpy=$tmp;
// echo "size at start ".sizeof($tmp[0])."<BR>";
echo "1st implode call: ".implode($cpy,"+")."<BR>";
echo "2nd implode call: ".implode($tmp[0],"+")."<BR>";
echo "size at end ".sizeof($tmp[0])."<BR>";
?>
gives the following output:
==============================
1st implode call: Array
Warning: Bad arguments to implode() in /usr/local/apache/htdocs/Widget/test.php on line 12
2nd implode call:
size at end 1
==============================
However uncommenting the first 'echo sizeof()' line gives the following result;
==============================
size at start 3
1st implode call: Array
2nd implode call: first_item+second_Item+third_item
size at end 3
==============================
something not being initialised in implode() ?