From: Antony Dovgal Date: Wed, 27 Jun 2007 12:17:30 +0000 (+0000) Subject: fix #41692 (ArrayObject shows weird behaviour in respect to inheritance) X-Git-Tag: BEFORE_IMPORT_OF_MYSQLND~372 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a77541ebc2669fe708efd5748cba117d5a66f9f6;p=php fix #41692 (ArrayObject shows weird behaviour in respect to inheritance) --- diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c index 26ee8d5336..9212dace9f 100755 --- a/ext/spl/spl_array.c +++ b/ext/spl/spl_array.c @@ -942,7 +942,7 @@ SPL_METHOD(Array, __construct) 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; } diff --git a/ext/spl/tests/bug41692.phpt b/ext/spl/tests/bug41692.phpt new file mode 100644 index 0000000000..1729fd15d3 --- /dev/null +++ b/ext/spl/tests/bug41692.phpt @@ -0,0 +1,106 @@ +--TEST-- +Bug #41692 (ArrayObject shows weird behaviour in respect to inheritance) +--FILE-- +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