moriyoshi Fri Feb 14 13:44:51 2003 EDT
Added files: (Branch: PHP_4_3)
/php4/ext/standard/tests/strings bug22224.phpt
Modified files:
/php4/ext/standard string.c
Log:
MFH(r1.357): Fixed bug #22224
MFH: Added test case for the bug
Index: php4/ext/standard/string.c
diff -u php4/ext/standard/string.c:1.333.2.12 php4/ext/standard/string.c:1.333.2.13
--- php4/ext/standard/string.c:1.333.2.12 Mon Feb 10 14:37:27 2003
+++ php4/ext/standard/string.c Fri Feb 14 13:44:50 2003
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: string.c,v 1.333.2.12 2003/02/10 19:37:27 pollita Exp $ */
+/* $Id: string.c,v 1.333.2.13 2003/02/14 18:44:50 moriyoshi Exp $ */
/* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
@@ -836,7 +836,8 @@
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