cvs: ZendEngine2(PHP_5_0) / zend_builtin_functions.c /tests bug29505.phpt
| From: | Marcus Boerger | Date: | Tue, 03 Aug 2004 17:02:35 +0000 |
| Subject: | cvs: ZendEngine2(PHP_5_0) / zend_builtin_functions.c /tests bug29505.phpt | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-2844@lists.php.net to get a copy of this message | ||
helly Tue Aug 3 13:02:35 2004 EDT
Added files: (Branch: PHP_5_0)
/ZendEngine2/tests bug29505.phpt
Modified files:
/ZendEngine2 zend_builtin_functions.c
Log:
- MFH Bug #29505 get_class_vars() severely broken when used with arrays
http://cvs.php.net/diff.php/ZendEngine2/zend_builtin_functions.c?r1=1.239.2.2&r2=1.239.2.3&ty=u
Index: ZendEngine2/zend_builtin_functions.c
diff -u ZendEngine2/zend_builtin_functions.c:1.239.2.2
ZendEngine2/zend_builtin_functions.c:1.239.2.3
--- ZendEngine2/zend_builtin_functions.c:1.239.2.2 Wed Jul 21 18:22:21 2004
+++ ZendEngine2/zend_builtin_functions.c Tue Aug 3 13:02:35 2004
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_builtin_functions.c,v 1.239.2.2 2004/07/21 22:22:21 edink Exp $ */
+/* $Id: zend_builtin_functions.c,v 1.239.2.3 2004/08/03 17:02:35 helly Exp $ */
#include "zend.h"
#include "zend_API.h"
@@ -701,6 +701,12 @@
zval_copy_ctor(prop_copy);
INIT_PZVAL(prop_copy);
+ /* this is necessary to make it able to work with default array
+ * properties, returned to user */
+ if (Z_TYPE_P(prop_copy) == IS_CONSTANT_ARRAY || Z_TYPE_P(prop_copy) == IS_CONSTANT) {
+ zval_update_constant(&prop_copy, 0 TSRMLS_CC);
+ }
+
add_assoc_zval(return_value, prop_name, prop_copy);
}
}
http://cvs.php.net/co.php/ZendEngine2/tests/bug29505.phpt?r=1.1&p=1
Index: ZendEngine2/tests/bug29505.phpt
+++ ZendEngine2/tests/bug29505.phpt
--TEST--
Bug #29505 (get_class_vars() severely broken when used with arrays)
--FILE--
<?php
class Test {
public $empty = array();
public $three = array(1, "b"=>"c", 3=>array());
}
var_dump(get_class_vars('Test'));
?>
===DONE===
--EXPECT--
array(2) {
["empty"]=>
array(0) {
}
["three"]=>
array(3) {
[0]=>
int(1)
["b"]=>
string(1) "c"
[3]=>
array(0) {
}
}
}
===DONE===