Skip to content

Commit 4aece83

Browse files
krakjoenikic
authored andcommitted
test and fix
1 parent 6ae9aa8 commit 4aece83

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

Zend/tests/first_class_callable_008.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ class Foo {
99
new Foo(...);
1010
?>
1111
--EXPECTF--
12-
Fatal error: cannot create Closure from call to constructor in %s on line 6
12+
Fatal error: cannot create Closure for new expression in %s on line 6

Zend/zend_closures.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -781,7 +781,7 @@ void zend_closure_from_frame(zval *return_value, zend_execute_data *call) { /* {
781781
if (ZEND_CALL_INFO(call) & ZEND_CALL_HAS_THIS) {
782782
ZVAL_OBJ(&instance, Z_OBJ(call->This));
783783

784-
zend_create_fake_closure(return_value, mptr, mptr->common.scope, mptr->common.scope, &instance);
784+
zend_create_fake_closure(return_value, mptr, mptr->common.scope, Z_OBJCE(instance), &instance);
785785
} else {
786786
zend_create_fake_closure(return_value, mptr, mptr->common.scope, Z_CE(call->This), NULL);
787787
}

Zend/zend_compile.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3697,7 +3697,7 @@ void zend_compile_call_common(znode *result, zend_ast *args_ast, zend_function *
36973697
opline->extended_value = 0;
36983698

36993699
if (opline->opcode == ZEND_NEW) {
3700-
zend_error_noreturn(E_COMPILE_ERROR, "cannot create Closure from call to constructor");
3700+
zend_error_noreturn(E_COMPILE_ERROR, "cannot create Closure for new expression");
37013701
}
37023702

37033703
if (opline->opcode == ZEND_INIT_FCALL) {

0 commit comments

Comments
 (0)