Skip to content

Commit ed59c00

Browse files
committed
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2: Fix phpGH-16799: Assertion failure at Zend/zend_vm_execute.h:7469
2 parents 716b03d + 553d79c commit ed59c00

File tree

4 files changed

+63
-0
lines changed

4 files changed

+63
-0
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ PHP NEWS
99
. Fail early in *nix configuration build script. (hakre)
1010
. Fixed bug GH-16727 (Opcache bad signal 139 crash in ZTS bookworm
1111
(frankenphp)). (nielsdos)
12+
. Fixed bug GH-16799 (Assertion failure at Zend/zend_vm_execute.h:7469).
13+
(nielsdos)
1214

1315
- FPM:
1416
. Fixed GH-16432 (PHP-FPM 8.2 SIGSEGV in fpm_get_status). (Jakub Zelenka)

Zend/tests/gh16799.phpt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
--TEST--
2+
GH-16799 (Assertion failure at Zend/zend_vm_execute.h)
3+
--FILE--
4+
<?php
5+
set_error_handler(function($_, $m) { throw new Exception($m); });
6+
class Test {
7+
static function test() {
8+
call_user_func("static::ok");
9+
}
10+
static function ok() {
11+
}
12+
}
13+
Test::test();
14+
?>
15+
--EXPECTF--
16+
Fatal error: Uncaught Exception: Use of "static" in callables is deprecated in %s:%d
17+
Stack trace:
18+
#0 %s(%d): {closure}(%d, 'Use of "static"...', %s, %d)
19+
#1 %s(%d): Test::test()
20+
#2 {main}
21+
thrown in %s on line %d

Zend/zend_vm_def.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3850,6 +3850,16 @@ ZEND_VM_HANDLER(118, ZEND_INIT_USER_CALL, CONST, CONST|TMPVAR|CV, NUM)
38503850
function_name = GET_OP2_ZVAL_PTR(BP_VAR_R);
38513851
if (zend_is_callable_ex(function_name, NULL, 0, NULL, &fcc, &error)) {
38523852
ZEND_ASSERT(!error);
3853+
3854+
/* Deprecation can be emitted from zend_is_callable_ex(), which can
3855+
* invoke a user error handler and throw an exception.
3856+
* For the CONST and CV case we reuse the same exception block below
3857+
* to make sure we don't increase VM size too much. */
3858+
if (!(OP2_TYPE & (IS_TMP_VAR|IS_VAR)) && UNEXPECTED(EG(exception))) {
3859+
FREE_OP2();
3860+
HANDLE_EXCEPTION();
3861+
}
3862+
38533863
func = fcc.function_handler;
38543864
object_or_called_scope = fcc.called_scope;
38553865
if (func->common.fn_flags & ZEND_ACC_CLOSURE) {

Zend/zend_vm_execute.h

Lines changed: 30 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)