Skip to content

Fix GH-16799: Assertion failure at Zend/zend_vm_execute.h:7469 #16803

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions Zend/tests/gh16799.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
--TEST--
GH-16799 (Assertion failure at Zend/zend_vm_execute.h:7469)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: The lineno is pretty useless.

--FILE--
<?php
set_error_handler(function($_, $m) { throw new Exception($m); });
class Test {
static function test() {
call_user_func("static::ok");
}
static function ok() {
}
}
Test::test();
?>
--EXPECTF--
Fatal error: Uncaught Exception: Use of "static" in callables is deprecated in %s:%d
Stack trace:
#0 %s(%d): {closure}(%d, 'Use of "static"...', %s, %d)
#1 %s(%d): Test::test()
#2 {main}
thrown in %s on line %d
9 changes: 9 additions & 0 deletions Zend/zend_vm_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -3806,6 +3806,15 @@ ZEND_VM_HANDLER(118, ZEND_INIT_USER_CALL, CONST, CONST|TMPVAR|CV, NUM)
SAVE_OPLINE();
function_name = GET_OP2_ZVAL_PTR(BP_VAR_R);
if (zend_is_callable_ex(function_name, NULL, 0, NULL, &fcc, &error)) {
/* Deprecation can be emitted from zend_is_callable_ex(), which can
* invoke a user error handler and throw an exception.
* For the CONST and CV case we reuse the same exception block below
* to make sure we don't increase VM size too much. */
if (!(OP2_TYPE & (IS_TMP_VAR|IS_VAR)) && UNEXPECTED(EG(exception))) {
FREE_OP2();
HANDLE_EXCEPTION();
}

ZEND_ASSERT(!error);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This assert still applies? Can we move it up?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

func = fcc.function_handler;
object_or_called_scope = fcc.called_scope;
Expand Down
27 changes: 27 additions & 0 deletions Zend/zend_vm_execute.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading