Skip to content

Commit c6cfd7f

Browse files
committed
test and fix
1 parent 466b95b commit c6cfd7f

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
@@ -766,7 +766,7 @@ void zend_closure_from_frame(zval *return_value, zend_execute_data *call) { /* {
766766
if (ZEND_CALL_INFO(call) & ZEND_CALL_HAS_THIS) {
767767
ZVAL_OBJ(&instance, Z_OBJ(call->This));
768768

769-
zend_create_fake_closure(return_value, mptr, mptr->common.scope, mptr->common.scope, &instance);
769+
zend_create_fake_closure(return_value, mptr, mptr->common.scope, Z_OBJCE(instance), &instance);
770770
} else {
771771
zend_create_fake_closure(return_value, mptr, mptr->common.scope, Z_CE(call->This), NULL);
772772
}

Zend/zend_compile.c

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

37043704
if (opline->opcode == ZEND_NEW) {
3705-
zend_error_noreturn(E_COMPILE_ERROR, "cannot create Closure from call to constructor");
3705+
zend_error_noreturn(E_COMPILE_ERROR, "cannot create Closure for new expression");
37063706
}
37073707

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

0 commit comments

Comments
 (0)