]> granicus.if.org Git - php/commitdiff
Revert array_slice passthrough optimization
authorSara Golemon <pollita@php.net>
Mon, 30 Oct 2017 15:07:16 +0000 (11:07 -0400)
committerSara Golemon <pollita@php.net>
Mon, 30 Oct 2017 15:08:28 +0000 (11:08 -0400)
This reverts commit fabb5b7a7421280b43e6f11c59d9446f6b21e3e6.
This reverts commit e751e6cebad959592f223f99ffd2a60cdf51bed0.

NEWS
ext/standard/array.c

diff --git a/NEWS b/NEWS
index 32156cba1065e339a581fee9f02f03000644794f..6e95adb2a19914cf2cc45e212488931f22a1243e 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -118,8 +118,6 @@ PHP                                                                        NEWS
 - Standard:
   . Fixed unzserialize(), to disable creation of unsupported data structures
     through manually crafted strings. (Dmitry)
-  . Short circuit case where array_slice() would return its original array.
-    (Sara, Benjamin Coutu)
 
 - Zlib:
   . Added zlib/level context option for compress.zlib wrapper. (Sara)
index 1c1816765ba60ef34dc57375ccb473a8ac78fdff..0cd2c5c64af2462eda8c71f2921b9fe1a238c500 100644 (file)
@@ -3563,15 +3563,6 @@ PHP_FUNCTION(array_slice)
                return;
        }
 
-       if ((offset == 0) && (length >= num_in)) {
-               zend_array *ht = Z_ARRVAL_P(input);
-               if (preserve_keys || (HT_IS_PACKED(ht) && HT_IS_WITHOUT_HOLES(ht))) {
-                       /* No real slicing, and the keys will match, so just copy */
-                       ZVAL_COPY(return_value, input);
-                       return;
-               }
-       }
-
        /* Initialize returned array */
        array_init_size(return_value, (uint32_t)length);