@@ -2493,35 +2493,33 @@ PHP_FUNCTION(extract)
2493
2493
break ;
2494
2494
}
2495
2495
} else {
2496
+ /* The array might be stored in a local variable that will be overwritten */
2497
+ zval array_copy ;
2498
+ ZVAL_COPY (& array_copy , var_array_param );
2496
2499
switch (extract_type ) {
2497
2500
case EXTR_IF_EXISTS :
2498
- count = php_extract_if_exists (Z_ARRVAL_P ( var_array_param ), symbol_table );
2501
+ count = php_extract_if_exists (Z_ARRVAL ( array_copy ), symbol_table );
2499
2502
break ;
2500
2503
case EXTR_OVERWRITE :
2501
- {
2502
- zval zv ;
2503
- /* The array might be stored in a local variable that will be overwritten */
2504
- ZVAL_COPY (& zv , var_array_param );
2505
- count = php_extract_overwrite (Z_ARRVAL (zv ), symbol_table );
2506
- zval_ptr_dtor (& zv );
2507
- }
2504
+ count = php_extract_overwrite (Z_ARRVAL (array_copy ), symbol_table );
2508
2505
break ;
2509
2506
case EXTR_PREFIX_IF_EXISTS :
2510
- count = php_extract_prefix_if_exists (Z_ARRVAL_P ( var_array_param ), symbol_table , prefix );
2507
+ count = php_extract_prefix_if_exists (Z_ARRVAL ( array_copy ), symbol_table , prefix );
2511
2508
break ;
2512
2509
case EXTR_PREFIX_SAME :
2513
- count = php_extract_prefix_same (Z_ARRVAL_P ( var_array_param ), symbol_table , prefix );
2510
+ count = php_extract_prefix_same (Z_ARRVAL ( array_copy ), symbol_table , prefix );
2514
2511
break ;
2515
2512
case EXTR_PREFIX_ALL :
2516
- count = php_extract_prefix_all (Z_ARRVAL_P ( var_array_param ), symbol_table , prefix );
2513
+ count = php_extract_prefix_all (Z_ARRVAL ( array_copy ), symbol_table , prefix );
2517
2514
break ;
2518
2515
case EXTR_PREFIX_INVALID :
2519
- count = php_extract_prefix_invalid (Z_ARRVAL_P ( var_array_param ), symbol_table , prefix );
2516
+ count = php_extract_prefix_invalid (Z_ARRVAL ( array_copy ), symbol_table , prefix );
2520
2517
break ;
2521
2518
default :
2522
- count = php_extract_skip (Z_ARRVAL_P ( var_array_param ), symbol_table );
2519
+ count = php_extract_skip (Z_ARRVAL ( array_copy ), symbol_table );
2523
2520
break ;
2524
2521
}
2522
+ zval_ptr_dtor (& array_copy );
2525
2523
}
2526
2524
2527
2525
RETURN_LONG (count );
0 commit comments