Browse Source

Revert array_slice passthrough optimization

This reverts commit fabb5b7a74.
This reverts commit e751e6ceba.
pull/2889/head
Sara Golemon 8 years ago
parent
commit
bbf57b114f
No known key found for this signature in database GPG Key ID: DBDB397470D12172
  1. 2
      NEWS
  2. 9
      ext/standard/array.c

2
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)

9
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);

Loading…
Cancel
Save