1
0
mirror of https://github.com/php/php-src.git synced 2026-04-15 20:11:02 +02:00

Merge branch 'PHP-7.3' into PHP-7.4

* PHP-7.3:
  Fix freeing of dynamic call name
This commit is contained in:
Nikita Popov
2019-12-18 10:11:23 +01:00
3 changed files with 30 additions and 10 deletions

View File

@@ -0,0 +1,28 @@
--TEST--
Freeing of function "name" when dynamic call fails
--FILE--
<?php
try {
$bar = "bar";
("foo" . $bar)();
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
try {
$bar = ["bar"];
(["foo"] + $bar)();
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
try {
(new stdClass)();
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
Call to undefined function foobar()
Function name must be a string
Function name must be a string

View File

@@ -3816,11 +3816,11 @@ ZEND_VM_C_LABEL(try_function_name):
call = NULL;
}
FREE_OP2();
if (UNEXPECTED(!call)) {
HANDLE_EXCEPTION();
}
FREE_OP2();
if (OP2_TYPE & (IS_VAR|IS_TMP_VAR)) {
if (UNEXPECTED(EG(exception))) {
if (call) {
@@ -3832,8 +3832,6 @@ ZEND_VM_C_LABEL(try_function_name):
}
HANDLE_EXCEPTION();
}
} else if (UNEXPECTED(!call)) {
HANDLE_EXCEPTION();
}
call->prev_execute_data = EX(call);

View File

@@ -2951,8 +2951,6 @@ try_function_name:
}
HANDLE_EXCEPTION();
}
} else if (UNEXPECTED(!call)) {
HANDLE_EXCEPTION();
}
call->prev_execute_data = EX(call);
@@ -3107,11 +3105,11 @@ try_function_name:
call = NULL;
}
zval_ptr_dtor_nogc(free_op2);
if (UNEXPECTED(!call)) {
HANDLE_EXCEPTION();
}
zval_ptr_dtor_nogc(free_op2);
if ((IS_TMP_VAR|IS_VAR) & (IS_VAR|IS_TMP_VAR)) {
if (UNEXPECTED(EG(exception))) {
if (call) {
@@ -3123,8 +3121,6 @@ try_function_name:
}
HANDLE_EXCEPTION();
}
} else if (UNEXPECTED(!call)) {
HANDLE_EXCEPTION();
}
call->prev_execute_data = EX(call);
@@ -3240,8 +3236,6 @@ try_function_name:
}
HANDLE_EXCEPTION();
}
} else if (UNEXPECTED(!call)) {
HANDLE_EXCEPTION();
}
call->prev_execute_data = EX(call);