]> granicus.if.org Git - php/commitdiff
Fixed #70053 MutlitpleIterator array-keys incompatible change in PHP 7
authorTjerk Meesters <datibbaw@php.net>
Sun, 12 Jul 2015 16:33:55 +0000 (00:33 +0800)
committerTjerk Meesters <datibbaw@php.net>
Sun, 12 Jul 2015 16:33:55 +0000 (00:33 +0800)
NEWS
ext/spl/spl_observer.c
ext/spl/tests/bug70053.phpt [new file with mode: 0644]

diff --git a/NEWS b/NEWS
index 3ba24cf8e4beeb99f453da0e547ebc6a8884794c..cbba441d0caa2cca231a20d9cd3cfb6db56be801 100644 (file)
--- a/NEWS
+++ b/NEWS
   . 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)
 
index 5ad1c5d12f3db955d4d267ff6c18c46f5fb7682f..6a9e27a6016ccb148fd534f547c83e4b3d293be3 100644 (file)
@@ -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 (file)
index 0000000..2cab083
--- /dev/null
@@ -0,0 +1,21 @@
+--TEST--
+SPL: ArrayObject
+--FILE--
+<?php
+
+echo "-- Two empty iterators attached with infos that are different but same array key --\n";
+$mit = new MultipleIterator(MultipleIterator::MIT_KEYS_ASSOC);
+$mit ->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
+}