You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(gdb) bt
#0 zend_compile_memoized_expr (expr=0x7fffc76209c0, result=0x0) at /build/php.git/Zend/zend_compile.c:2351
#1 zend_compile_expr_inner (ast=0x7fffc76209c0, result=0x0) at /build/php.git/Zend/zend_compile.c:9510
#2 zend_compile_expr (result=0x0, ast=0x7fffc76209c0) at /build/php.git/Zend/zend_compile.c:9651
#3 0x00000000006932fa in zend_compile_stmt (ast=0x7fffc76209c0) at /build/php.git/Zend/zend_compile.c:9488
#4 0x000000000069319f in zend_compile_stmt_list (ast=<optimized out>) at /build/php.git/Zend/zend_compile.c:6000
#5 zend_compile_stmt_list (ast=<optimized out>) at /build/php.git/Zend/zend_compile.c:5995
#6 zend_compile_stmt (ast=ast@entry=0x7fffc7620818) at /build/php.git/Zend/zend_compile.c:9405
#7 0x00000000006a04c8 in zend_compile_if (ast=ast@entry=0x7fffc76209e8) at /build/php.git/Zend/zend_compile.c:5245
#8 0x0000000000693328 in zend_compile_stmt (ast=0x7fffc76209e8) at /build/php.git/Zend/zend_compile.c:9445
#9 0x000000000069319f in zend_compile_stmt_list (ast=<optimized out>) at /build/php.git/Zend/zend_compile.c:6000
#10 zend_compile_stmt_list (ast=<optimized out>) at /build/php.git/Zend/zend_compile.c:5995
#11 zend_compile_stmt (ast=ast@entry=0x7fffc76205e8) at /build/php.git/Zend/zend_compile.c:9405
#12 0x00000000006a04c8 in zend_compile_if (ast=ast@entry=0x7fffc7620b38) at /build/php.git/Zend/zend_compile.c:5245
#13 0x0000000000693328 in zend_compile_stmt (ast=0x7fffc7620b38) at /build/php.git/Zend/zend_compile.c:9445
#14 0x000000000069319f in zend_compile_stmt_list (ast=<optimized out>) at /build/php.git/Zend/zend_compile.c:6000
#15 zend_compile_stmt_list (ast=<optimized out>) at /build/php.git/Zend/zend_compile.c:5995
#16 zend_compile_stmt (ast=ast@entry=0x7fffc7620178) at /build/php.git/Zend/zend_compile.c:9405
#17 0x0000000000693582 in zend_compile_try (ast=<optimized out>) at /build/php.git/Zend/zend_compile.c:5730
#18 0x00000000006933f0 in zend_compile_stmt (ast=0x7fffc7620ff0) at /build/php.git/Zend/zend_compile.c:9451
#19 0x000000000069319f in zend_compile_stmt_list (ast=<optimized out>) at /build/php.git/Zend/zend_compile.c:6000
#20 zend_compile_stmt_list (ast=<optimized out>) at /build/php.git/Zend/zend_compile.c:5995
#21 zend_compile_stmt (ast=ast@entry=0x7fffc761ffb0) at /build/php.git/Zend/zend_compile.c:9405
#22 0x000000000069443a in zend_compile_func_decl (result=<optimized out>, ast=<optimized out>, toplevel=<optimized out>) at /build/php.git/Zend/zend_compile.c:6999
#23 0x000000000069321c in zend_compile_stmt (ast=0x7fffc7621048) at /build/php.git/Zend/zend_compile.c:9458
#24 0x000000000069319f in zend_compile_stmt_list (ast=<optimized out>) at /build/php.git/Zend/zend_compile.c:6000
#25 zend_compile_stmt_list (ast=<optimized out>) at /build/php.git/Zend/zend_compile.c:5995
#26 zend_compile_stmt (ast=ast@entry=0x7fffc762df48) at /build/php.git/Zend/zend_compile.c:9405
#27 0x0000000000694e7d in zend_compile_class_decl (result=0x0, ast=0x7fffc763d200, toplevel=<optimized out>) at /build/php.git/Zend/zend_compile.c:7409
#28 0x00000000006a1998 in zend_compile_top_stmt (ast=0x7fffc763d200) at /build/php.git/Zend/zend_compile.c:9380
#29 0x00000000006a19c8 in zend_compile_top_stmt (ast=0x7fffc761a018) at /build/php.git/Zend/zend_compile.c:9369
#30 0x000000000066e371 in zend_compile (type=type@entry=2) at Zend/zend_language_scanner.l:629
#31 0x000000000066fc1a in compile_file (file_handle=0x7fffffffb1f0, type=2) at Zend/zend_language_scanner.l:664
#32 0x00007fffe804f077 in phar_compile_file (file_handle=0x7fffffffb1f0, type=2) at /build/php.git/ext/phar/phar.c:3373
#33 0x00000000006e34c2 in zend_include_or_eval (inc_filename=0x7ffff4815560, type=4) at /build/php.git/Zend/zend_execute.c:4467
#34 0x00000000006f9b6c in ZEND_INCLUDE_OR_EVAL_SPEC_OBSERVER_HANDLER () at /build/php.git/Zend/zend_vm_execute.h:4791
#35 0x0000000000713b6f in execute_ex (ex=0xe1fc28 <compiler_globals+520>) at /build/php.git/Zend/zend_vm_execute.h:55592
#36 0x00000000006a529a in zend_call_function (fci=0x7fffffffb490, fci_cache=0x7fffffffb470) at /build/php.git/Zend/zend_execute_API.c:896
#37 0x00000000006a5694 in zend_call_known_function (fn=0x7ffff48cc178, object=<optimized out>, called_scope=0x0, retval_ptr=retval_ptr@entry=0x0, param_count=param_count@entry=1,
params=params@entry=0x7fffffffb500, named_params=0x0) at /build/php.git/Zend/zend_execute_API.c:986
#38 0x0000000000573495 in spl_perform_autoload (class_name=0x7fffdaf8edb0, lc_name=0x7fffdaf8ede0) at /build/php.git/ext/spl/php_spl.c:440
#39 0x00000000006a4501 in zend_lookup_class_ex (name=name@entry=0x7fffdaf8edb0, key=0x7fffdaf8ede0, flags=flags@entry=512) at /build/php.git/Zend/zend_execute_API.c:1111
#40 0x00000000006a5b1c in zend_fetch_class_by_name (class_name=0x7fffdaf8edb0, key=<optimized out>, fetch_type=fetch_type@entry=512) at /build/php.git/Zend/zend_execute_API.c:1522
#41 0x00000000006f7dd7 in ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CONST_HANDLER () at /build/php.git/Zend/zend_vm_execute.h:6610
#42 0x000000000071530e in execute_ex (ex=0xe1fc28 <compiler_globals+520>) at /build/php.git/Zend/zend_vm_execute.h:55772
#43 0x00000000006a529a in zend_call_function (fci=0x7fffffffb780, fci_cache=0x7fffffffb6c0) at /build/php.git/Zend/zend_execute_API.c:896
#44 0x00000000006a55a5 in _call_user_function_impl (object=object@entry=0x0, function_name=function_name@entry=0x7fffdacaf4c0, retval_ptr=retval_ptr@entry=0x7fffffffb7d0, param_count=<optimized out>,
params=<optimized out>, named_params=named_params@entry=0x0) at /build/php.git/Zend/zend_execute_API.c:660
#45 0x00000000005b19df in user_shutdown_function_call (zv=<optimized out>) at /build/php.git/ext/standard/basic_functions.c:1693
#46 0x00000000006c4f9b in zend_hash_apply (ht=0x7fffdae5b8f8, apply_func=apply_func@entry=0x5b19b0 <user_shutdown_function_call>) at /build/php.git/Zend/zend_hash.c:1837
--Type <RET> for more, q to quit, c to continue without paging--
#47 0x00000000005b4b11 in php_call_shutdown_functions () at /build/php.git/ext/standard/basic_functions.c:1766
#48 0x0000000000643585 in php_request_shutdown (dummy=dummy@entry=0x0) at /build/php.git/main/main.c:1821
#49 0x00000000007427ae in do_cli (argc=4, argv=0xe37af0) at /build/php.git/sapi/cli/php_cli.c:1111
#50 0x0000000000455c22 in main (argc=4, argv=0xe37af0) at /build/php.git/sapi/cli/php_cli.c:1341
It seems like there's an attempt to dereference result which is NULL...
PHP Version
8.0.28, 8.2.3
Operating System
CentOS Stream 8, macOS
The text was updated successfully, but these errors were encountered:
mikhainin
changed the title
Segfault when compiling code on request shutdown after fatal error
Segfault when compiling code on the request shutdown after a fatal error
Apr 20, 2023
This is caused by an incorrect state of the compiler globals after bailout. test.php fails at the line $messageList[$host][] ??= []; (Cannot use [] for reading). The global CG(memoized_exprs) is usually reset after zend_compile_assign_coalesce but not here due to the bailout. The shutdown handler then tries to compile another file (shutdown.php) which depends on CG(memoized_exprs) being set properly.
A simple fix is to reset CG(memoized_exprs) in _zend_bailout() (thanks for the suggestion @bwoebi 🙂). Unfortunately, the shutdown handler after bailout is inherently unstable.
iluuu1994
added a commit
to iluuu1994/php-src
that referenced
this issue
Apr 20, 2023
Uh oh!
There was an error while loading. Please reload this page.
Description
The following code:
shutdown.php
test.php
Resulted in this output:
But I expected this output instead:
I can see the following stacktrace on Mac (PHP 8.2.3):
Linux (PHP 8.0.28):
It seems like there's an attempt to dereference
result
which is NULL...PHP Version
8.0.28, 8.2.3
Operating System
CentOS Stream 8, macOS
The text was updated successfully, but these errors were encountered: