We need to free op2 if the call construction fails.
Also remove a redundant check for !call.
--- /dev/null
+--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
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) {
}
HANDLE_EXCEPTION();
}
- } else if (UNEXPECTED(!call)) {
- HANDLE_EXCEPTION();
}
call->prev_execute_data = EX(call);
}
HANDLE_EXCEPTION();
}
- } else if (UNEXPECTED(!call)) {
- HANDLE_EXCEPTION();
}
call->prev_execute_data = EX(call);
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) {
}
HANDLE_EXCEPTION();
}
- } else if (UNEXPECTED(!call)) {
- HANDLE_EXCEPTION();
}
call->prev_execute_data = EX(call);
}
HANDLE_EXCEPTION();
}
- } else if (UNEXPECTED(!call)) {
- HANDLE_EXCEPTION();
}
call->prev_execute_data = EX(call);