[PHP-DEV] PHP 4.0 Bug #1932: implode() changes array contents From: alan <email protected>
Date: 07/30/99

From: alan <email protected>
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() ?

-- 
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>