From: Tjerk Meesters Date: Sun, 12 Jul 2015 16:33:55 +0000 (+0800) Subject: Fixed #70053 MutlitpleIterator array-keys incompatible change in PHP 7 X-Git-Tag: php-7.1.1RC1~35^2~15^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=03d18d9a52065689d27384e95a54b7ae01e77780;p=php Fixed #70053 MutlitpleIterator array-keys incompatible change in PHP 7 --- diff --git a/NEWS b/NEWS index 3ba24cf8e4..cbba441d0c 100644 --- a/NEWS +++ b/NEWS @@ -16,6 +16,10 @@ . Fixed bug #70032 (make_http_soap_request calls zend_hash_get_current_key_ex(,,,NULL). (Laruence) +- SPL: + . Fixed bug #70053 (MutlitpleIterator array-keys incompatible change in + PHP 7). (Tjerk) + - Standard: . Fixed bug #70018 (exec does not strip all whitespace). (Laruence) diff --git a/ext/spl/spl_observer.c b/ext/spl/spl_observer.c index 5ad1c5d12f..6a9e27a601 100644 --- a/ext/spl/spl_observer.c +++ b/ext/spl/spl_observer.c @@ -1182,7 +1182,7 @@ static void spl_multiple_iterator_get_all(spl_SplObjectStorage *intern, int get_ add_index_zval(return_value, Z_LVAL(element->inf), &retval); break; case IS_STRING: - zend_hash_update(Z_ARRVAL_P(return_value), Z_STR(element->inf), &retval); + zend_symtable_update(Z_ARRVAL_P(return_value), Z_STR(element->inf), &retval); break; default: zval_ptr_dtor(&retval); diff --git a/ext/spl/tests/bug70053.phpt b/ext/spl/tests/bug70053.phpt new file mode 100644 index 0000000000..2cab083c37 --- /dev/null +++ b/ext/spl/tests/bug70053.phpt @@ -0,0 +1,21 @@ +--TEST-- +SPL: ArrayObject +--FILE-- +attachIterator(new EmptyIterator(), "2"); +$mit ->attachIterator(new EmptyIterator(), 2); +var_dump($mit->countIterators()); +$mit->rewind(); +var_dump($mit->current()); + +?> +--EXPECT-- +-- Two empty iterators attached with infos that are different but same array key -- +int(2) +array(1) { + [2]=> + NULL +}