Skip to content

Commit c8ff342

Browse files
committed
Duplicate array only if neccessary
1 parent 7faac02 commit c8ff342

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

ext/standard/array.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1365,11 +1365,14 @@ PHP_FUNCTION(extract)
13651365
int extract_refs = 0;
13661366
zend_array *symbol_table;
13671367

1368-
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/|lz/", &var_array, &extract_type, &prefix) == FAILURE) {
1368+
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|lz/", &var_array, &extract_type, &prefix) == FAILURE) {
13691369
return;
13701370
}
13711371

13721372
extract_refs = (extract_type & EXTR_REFS);
1373+
if (extract_refs) {
1374+
SEPARATE_ZVAL(var_array);
1375+
}
13731376
extract_type &= 0xff;
13741377

13751378
if (extract_type < EXTR_OVERWRITE || extract_type > EXTR_IF_EXISTS) {

0 commit comments

Comments
 (0)