Fix handling of parse_str() with unpack in optimizer

This commit is contained in:
Nikita Popov 2016-06-05 22:16:15 +02:00
parent 70f0546885
commit 3be92120ba
2 changed files with 17 additions and 2 deletions

View File

@ -0,0 +1,15 @@
--TEST--
Calling parse_str through argument unpacking
--FILE--
<?php
function test() {
$i = 0;
parse_str(...["i=41"]);
var_dump($i + 1);
}
test();
?>
--EXPECT--
int(42)

View File

@ -596,9 +596,9 @@ uint32_t zend_optimizer_classify_function(zend_string *name, uint32_t num_args)
return ZEND_FUNC_INDIRECT_VAR_ACCESS;
} else if (zend_string_equals_literal(name, "compact")) {
return ZEND_FUNC_INDIRECT_VAR_ACCESS;
} else if (zend_string_equals_literal(name, "parse_str") && num_args == 1) {
} else if (zend_string_equals_literal(name, "parse_str") && num_args <= 1) {
return ZEND_FUNC_INDIRECT_VAR_ACCESS;
} else if (zend_string_equals_literal(name, "mb_parse_str") && num_args == 1) {
} else if (zend_string_equals_literal(name, "mb_parse_str") && num_args <= 1) {
return ZEND_FUNC_INDIRECT_VAR_ACCESS;
} else if (zend_string_equals_literal(name, "get_defined_vars")) {
return ZEND_FUNC_INDIRECT_VAR_ACCESS;