moriyoshi Fri Feb 14 13:42:36 2003 EDT
Added files:
/php4/ext/standard/tests/strings bug22224.phpt
Modified files:
/php4/ext/standard string.c
Log:
Fixed bug #22224 (implode changes object references in array)
Added test case for the bug
Index: php4/ext/standard/string.c
diff -u php4/ext/standard/string.c:1.356 php4/ext/standard/string.c:1.357
--- php4/ext/standard/string.c:1.356 Tue Feb 11 17:47:25 2003
+++ php4/ext/standard/string.c Fri Feb 14 13:42:36 2003
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: string.c,v 1.356 2003/02/11 22:47:25 iliaa Exp $ */
+/* $Id: string.c,v 1.357 2003/02/14 18:42:36 moriyoshi Exp $ */
/* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
@@ -835,7 +835,8 @@
zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(arr), &pos);
while (zend_hash_get_current_data_ex(Z_ARRVAL_P(arr), (void **) &tmp, &pos) ==
SUCCESS) {
- convert_to_string_ex(tmp);
+ SEPARATE_ZVAL(tmp);
+ convert_to_string(*tmp);
smart_str_appendl(&implstr, Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp));
if (++i != numelems) {
Index: php4/ext/standard/tests/strings/bug22224.phpt
+++ php4/ext/standard/tests/strings/bug22224.phpt
--TEST--
Bug #22224 (implode changes object references in array)
--INI--
error_reporting=0
--FILE--
<?php
class foo {
}
$a = new foo();
$arr = array(0=>&$a, 1=>&$a);
var_dump(implode(",",$arr));
var_dump($arr)
?>
--EXPECT--
string(13) "Object,Object"
array(2) {
[0]=>
&object(foo)(0) {
}
[1]=>
&object(foo)(0) {
}
}
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php