tony2001 Wed Jun 27 12:17:30 2007 UTC Added files: /php-src/ext/spl/tests bug41692.phpt
Modified files: /php-src/ext/spl spl_array.c Log: fix #41692 (ArrayObject shows weird behaviour in respect to inheritance) http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_array.c?r1=1.125&r2=1.126&diff_format=u Index: php-src/ext/spl/spl_array.c diff -u php-src/ext/spl/spl_array.c:1.125 php-src/ext/spl/spl_array.c:1.126 --- php-src/ext/spl/spl_array.c:1.125 Fri Apr 6 21:15:44 2007 +++ php-src/ext/spl/spl_array.c Wed Jun 27 12:17:29 2007 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: spl_array.c,v 1.125 2007/04/06 21:15:44 helly Exp $ */ +/* $Id: spl_array.c,v 1.126 2007/06/27 12:17:29 tony2001 Exp $ */ #ifdef HAVE_CONFIG_H # include "config.h" @@ -942,7 +942,7 @@ intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|lC", &array, &ar_flags, &ce_get_iterator) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z/|lC", &array, &ar_flags, &ce_get_iterator) == FAILURE) { php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); return; } http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/bug41692.phpt?view=markup&rev=1.1 Index: php-src/ext/spl/tests/bug41692.phpt +++ php-src/ext/spl/tests/bug41692.phpt --TEST-- Bug #41692 (ArrayObject shows weird behaviour in respect to inheritance) --FILE-- <?php class Bar extends ArrayObject { private $foo = array( 1, 2, 3 ); function __construct() { parent::__construct($this->foo); } } $foo = new Bar(); var_dump($foo); $foo['foo'] = 23; $bar = new Bar(); var_dump($bar); echo "Done\n"; ?> --EXPECTF-- object(Bar)#%d (2) { ["foo":"Bar":private]=> array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3) } ["storage":"ArrayObject":private]=> array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3) } } object(Bar)#%d (2) { ["foo":"Bar":private]=> array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3) } ["storage":"ArrayObject":private]=> array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3) } } Done --UEXPECTF-- object(Bar)#%d (2) { [u"foo":u"Bar":private]=> array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3) } [u"storage":u"ArrayObject":private]=> array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3) } } object(Bar)#%d (2) { [u"foo":u"Bar":private]=> array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3) } [u"storage":u"ArrayObject":private]=> array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3) } } Done -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php