From: Sara Golemon Date: Mon, 30 Oct 2017 15:07:16 +0000 (-0400) Subject: Revert array_slice passthrough optimization X-Git-Tag: php-7.3.0alpha1~1148 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bbf57b114f3a00de48005c2702a40fb22cd276c7;p=php Revert array_slice passthrough optimization This reverts commit fabb5b7a7421280b43e6f11c59d9446f6b21e3e6. This reverts commit e751e6cebad959592f223f99ffd2a60cdf51bed0. --- diff --git a/NEWS b/NEWS index 32156cba10..6e95adb2a1 100644 --- 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) diff --git a/ext/standard/array.c b/ext/standard/array.c index 1c1816765b..0cd2c5c64a 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -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);