Repository navigation
Conversation
…ontainers Report an undefined OP_DATA only when the value is assigned, after the false to array deprecation, and never report an undefined dim before "Cannot use a scalar value as an array", matching the VM.
ndossche
reviewed
Oct 30, 2026
…ting undefined OP_DATA
ndossche
approved these changes
Nov 22, 2026
Member
|
This causes the nightly MSAN build to fail: |
Member
|
Also an ASAN failure on PPC64: ========DIFF========
Automatic conversion of false to array is deprecated
Undefined variable $undef
003- int(1)
003+ =================================================================
004+ ==3497920==ERROR: AddressSanitizer: heap-use-after-free on address 0x3e6793ef87f2 at pc 0x000125ab17e0 bp 0x3fffc02b47b0 sp 0x3fffc02b4828
005+ READ of size 1 at 0x3e6793ef87f2 thread T0
006+ #0 0x125ab17dc in zend_assign_to_variable_ex /srv/actions/.cache/act/3080b9e50c85181b/hostexecutor/Zend/zend_execute.h:195:7
007+ #1 0x125407634 in ZEND_ASSIGN_DIM_SPEC_CV_CONST_OP_DATA_CV_HANDLER /srv/actions/.cache/act/3080b9e50c85181b/hostexecutor/Zend/zend_vm_execute.h:45641:12
008+ #2 0x1252d6788 in execute_ex /srv/actions/.cache/act/3080b9e50c85181b/hostexecutor/Zend/zend_vm_execute.h:116352:12
009+ #3 0x1252d9ad4 in zend_execute /srv/actions/.cache/act/3080b9e50c85181b/hostexecutor/Zend/zend_vm_execute.h:122064:2
010+ #4 0x126386fb0 in zend_execute_script /srv/actions/.cache/act/3080b9e50c85181b/hostexecutor/Zend/zend.c:1997:3
011+ #5 0x1244f2d64 in php_execute_script_ex /srv/actions/.cache/act/3080b9e50c85181b/hostexecutor/main/main.c:2680:13
012+ #6 0x1244f4614 in php_execute_script /srv/actions/.cache/act/3080b9e50c85181b/hostexecutor/main/main.c:2720:9
013+ #7 0x1263a1c54 in do_cli /srv/actions/.cache/act/3080b9e50c85181b/hostexecutor/sapi/cli/php_cli.c:962:5
014+ #8 0x12639af1c in main /srv/actions/.cache/act/3080b9e50c85181b/hostexecutor/sapi/cli/php_cli.c:1385:18
015+ #9 0x3fff97717000 (/usr/lib64/libc.so.6+0x27000)
016+ #10 0x3fff977172e4 in __libc_start_main (/usr/lib64/libc.so.6+0x272e4)
017+
018+ 0x3e6793ef87f2 is located 18 bytes inside of 136-byte region [0x3e6793ef87e0,0x3e6793ef8868)
019+ freed by thread T0 here:
020+ #0 0x11f1ed66c in free (/srv/actions/.cache/act/3080b9e50c85181b/hostexecutor/sapi/cli/php+0x2fed66c)
021+ #1 0x124de38d0 in tracked_free /srv/actions/.cache/act/3080b9e50c85181b/hostexecutor/Zend/zend_alloc.c:3375:2
022+ #2 0x124db4398 in _efree /srv/actions/.cache/act/3080b9e50c85181b/hostexecutor/Zend/zend_alloc.c:2932:3
023+ #3 0x125c4d75c in zend_array_destroy /srv/actions/.cache/act/3080b9e50c85181b/hostexecutor/Zend/zend_hash.c:2085:2
024+ #4 0x12631365c in rc_dtor_func /srv/actions/.cache/act/3080b9e50c85181b/hostexecutor/Zend/zend_variables.c:57:2
025+ #5 0x125ab08f8 in zend_assign_to_variable /srv/actions/.cache/act/3080b9e50c85181b/hostexecutor/Zend/zend_execute.h:183:4
026+ #6 0x1253a2bf4 in ZEND_ASSIGN_SPEC_VAR_CONST_RETVAL_UNUSED_HANDLER /srv/actions/.cache/act/3080b9e50c85181b/hostexecutor/Zend/zend_vm_execute.h:25949:11
027+ #7 0x1252d6788 in execute_ex /srv/actions/.cache/act/3080b9e50c85181b/hostexecutor/Zend/zend_vm_execute.h:116352:12
028+ #8 0x12524a480 in zend_call_function /srv/actions/.cache/act/3080b9e50c85181b/hostexecutor/Zend/zend_execute_API.c:1041:3
029+ #9 0x125240ff0 in _call_user_function_impl /srv/actions/.cache/act/3080b9e50c85181b/hostexecutor/Zend/zend_execute_API.c:820:9
030+ #10 0x12637ae40 in zend_error_zstr_at /srv/actions/.cache/act/3080b9e50c85181b/hostexecutor/Zend/zend.c:1598:10
031+ #11 0x12637f3f4 in zend_error_va_list /srv/actions/.cache/act/3080b9e50c85181b/hostexecutor/Zend/zend.c:1652:2
032+ #12 0x12637fad0 in zend_error_unchecked /srv/actions/.cache/act/3080b9e50c85181b/hostexecutor/Zend/zend.c:1726:2
033+ #13 0x125a96620 in zval_undefined_cv /srv/actions/.cache/act/3080b9e50c85181b/hostexecutor/Zend/zend_execute.c:280:3
034+ #14 0x125a9fbd8 in _get_zval_ptr_cv_BP_VAR_R /srv/actions/.cache/act/3080b9e50c85181b/hostexecutor/Zend/zend_execute.c:353:10
035+ #15 0x125407394 in ZEND_ASSIGN_DIM_SPEC_CV_CONST_OP_DATA_CV_HANDLER /srv/actions/.cache/act/3080b9e50c85181b/hostexecutor/Zend/zend_vm_execute.h:45640:12
036+ #16 0x1252d6788 in execute_ex /srv/actions/.cache/act/3080b9e50c85181b/hostexecutor/Zend/zend_vm_execute.h:116352:12
037+ #17 0x1252d9ad4 in zend_execute /srv/actions/.cache/act/3080b9e50c85181b/hostexecutor/Zend/zend_vm_execute.h:122064:2
038+ #18 0x126386fb0 in zend_execute_script /srv/actions/.cache/act/3080b9e50c85181b/hostexecutor/Zend/zend.c:1997:3
039+ #19 0x1244f2d64 in php_execute_script_ex /srv/actions/.cache/act/3080b9e50c85181b/hostexecutor/main/main.c:2680:13
040+ #20 0x1244f4614 in php_execute_script /srv/actions/.cache/act/3080b9e50c85181b/hostexecutor/main/main.c:2720:9
041+ #21 0x1263a1c54 in do_cli /srv/actions/.cache/act/3080b9e50c85181b/hostexecutor/sapi/cli/php_cli.c:962:5
042+ #22 0x12639af1c in main /srv/actions/.cache/act/3080b9e50c85181b/hostexecutor/sapi/cli/php_cli.c:1385:18
043+ #23 0x3fff97717000 (/usr/lib64/libc.so.6+0x27000)
044+ #24 0x3fff977172e4 in __libc_start_main (/usr/lib64/libc.so.6+0x272e4)
045+
046+ previously allocated by thread T0 here:
047+ #0 0x11f1ed9c0 in malloc (/srv/actions/.cache/act/3080b9e50c85181b/hostexecutor/sapi/cli/php+0x2fed9c0)
048+ #1 0x124da6038 in tracked_malloc /srv/actions/.cache/act/3080b9e50c85181b/hostexecutor/Zend/zend_alloc.c:3350:14
049+ #2 0x124db3b84 in _emalloc /srv/actions/.cache/act/3080b9e50c85181b/hostexecutor/Zend/zend_alloc.c:2922:10
050+ #3 0x125c00b44 in zend_hash_real_finit_packed_ex /srv/actions/.cache/act/3080b9e50c85181b/hostexecutor/Zend/zend_hash.c:160:10
051+ #4 0x125c33e80 in _zend_hash_index_add_or_update_i /srv/actions/.cache/act/3080b9e50c85181b/hostexecutor/Zend/zend_hash.c:1344:25
052+ #5 0x125c36190 in zend_hash_index_lookup /srv/actions/.cache/act/3080b9e50c85181b/hostexecutor/Zend/zend_hash.c:1449:9
053+ #6 0x125a8e844 in zend_fetch_dimension_address_inner /srv/actions/.cache/act/3080b9e50c85181b/hostexecutor/Zend/zend_execute.c:2829:4
054+ #7 0x125ab2318 in zend_fetch_dimension_address_inner_W_CONST /srv/actions/.cache/act/3080b9e50c85181b/hostexecutor/Zend/zend_execute.c:2891:9
055+ #8 0x1254071a4 in ZEND_ASSIGN_DIM_SPEC_CV_CONST_OP_DATA_CV_HANDLER /srv/actions/.cache/act/3080b9e50c85181b/hostexecutor/Zend/zend_vm_execute.h:45633:20
056+ #9 0x1252d6788 in execute_ex /srv/actions/.cache/act/3080b9e50c85181b/hostexecutor/Zend/zend_vm_execute.h:116352:12
057+ #10 0x1252d9ad4 in zend_execute /srv/actions/.cache/act/3080b9e50c85181b/hostexecutor/Zend/zend_vm_execute.h:122064:2
058+ #11 0x126386fb0 in zend_execute_script /srv/actions/.cache/act/3080b9e50c85181b/hostexecutor/Zend/zend.c:1997:3
059+ #12 0x1244f2d64 in php_execute_script_ex /srv/actions/.cache/act/3080b9e50c85181b/hostexecutor/main/main.c:2680:13
060+ #13 0x1244f4614 in php_execute_script /srv/actions/.cache/act/3080b9e50c85181b/hostexecutor/main/main.c:2720:9
061+ #14 0x1263a1c54 in do_cli /srv/actions/.cache/act/3080b9e50c85181b/hostexecutor/sapi/cli/php_cli.c:962:5
062+ #15 0x12639af1c in main /srv/actions/.cache/act/3080b9e50c85181b/hostexecutor/sapi/cli/php_cli.c:1385:18
063+ #16 0x3fff97717000 (/usr/lib64/libc.so.6+0x27000)
064+ #17 0x3fff977172e4 in __libc_start_main (/usr/lib64/libc.so.6+0x272e4)
065+
066+ SUMMARY: AddressSanitizer: heap-use-after-free /srv/actions/.cache/act/3080b9e50c85181b/hostexecutor/Zend/zend_execute.h:195:7 in zend_assign_to_variable_ex
067+ Shadow bytes around the buggy address:
068+ 0x3e6793ef8500: 00 00 00 00 00 04 fa fa fa fa fa fa fa fa 00 00
069+ 0x3e6793ef8580: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fa
070+ 0x3e6793ef8600: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
071+ 0x3e6793ef8680: 00 00 00 00 00 00 00 00 00 fa fa fa fa fa fa fa
072+ 0x3e6793ef8700: fa fa fd fd fd fd fd fd fd fd fd fd fd fd fd fd
073+ =>0x3e6793ef8780: fd fd fd fd fa fa fa fa fa fa fa fa fd fd[fd]fd
074+ 0x3e6793ef8800: fd fd fd fd fd fd fd fd fd fd fd fd fd fa fa fa
075+ 0x3e6793ef8880: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
076+ 0x3e6793ef8900: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
077+ 0x3e6793ef8980: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
078+ 0x3e6793ef8a00: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
079+ Shadow byte legend (one shadow byte represents 8 application bytes):
080+ Addressable: 00
081+ Partially addressable: 01 02 03 04 05 06 07
082+ Heap left redzone: fa
083+ Freed heap region: fd
084+ Stack left redzone: f1
085+ Stack mid redzone: f2
086+ Stack right redzone: f3
087+ Stack after return: f5
088+ Stack use after scope: f8
089+ Global redzone: f9
090+ Global init order: f6
091+ Poisoned by user: f7
092+ Container overflow: fc
093+ Array cookie: ac
094+ Intra object redzone: bb
095+ ASan internal: fe
096+ Left alloca redzone: ca
097+ Right alloca redzone: cb
098+ ==3497920==ABORTING
========DONE========
FAIL JIT ASSIGN_DIM: container converted from false is overwritten while reporting undefined OP_DATA [ext/opcache/tests/jit/assign_dim_undef_op_data_008.phpt] |
Contributor
Author
|
It exposed issues on instances where JIT is unavailable I think. Let me check it. |
arnaud-lb
added a commit
to bm1549/php-src
that referenced
this pull request
Nov 24, 2026
* PHP-8.5: (25 commits) [skip ci] Add APP_DEBUG=0 for Symfony Preloading test streams: fix stale readbuflen after stream_filter_remove() on a read filter Update NEWS for phpGH-20920 LibreSSL build fix Fix phpGH-20920: do not use OPENSSL_strndup() for peer CN matching Simplify php_openssl_load_all_certs_from_file() Fix phpGH-20920: only register PKCS7_NO_DUAL_CONTENT when it is defined Fix phpGH-20920: guard ENGINE_cleanup() with OPENSSL_NO_ENGINE again ext/soap: Fix NULL dereference on empty Body with matching SOAPAction (phpGH-25661) ext/dom: Fix use-after-free in getElementById() after removing an ID attribute ext/reflection: Don't call destructor when constructor is not public in newInstance(Args)() ext/phar: unset() of an entry with an open handle use-after-free. ext/intl: Fix IntlCalendar::setTime() build on PHP 8.5 and later ext/intl: Reject non-finite timestamps in IntlCalendar::setTime() (php#25668) [skip ci] Speed up community build [skip ci] Backport test-suite.yml changes from master Fix propagation of public(set) of readonly trait property Make test accept different outputs Fix phpGH-25528: Retain the Phar OpenSSL signing key (php#25529) ext/pdo_sqlite: Fix use-after-free of bound string and LOB parameters ext/opcache: Fix JIT ASSIGN_DIM undefined OP_DATA and dim reporting on non-array containers (phpGH-24665) ...
Contributor
Author
|
Follow-up fix for this issue #25701 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In function JIT,
zend_jit_assign_dim_helper()read an undefined OP_DATA before checking the container type. The VM reads it only when it actually assigns, so the JIT reported warnings in a different order, or where the VM reports none:$x = 1.5; $x[0] = $undef;Error: Cannot use a scalar value as an arrayUndefined variablewarning before the Error$x = 'ab'; $x[] = $undef;Error: [] operator not supported for stringsUndefined variablewarning before the Error$x = false; $x[0] = $undef;$x = 1.5; $x[$undef] = 1;Error: Cannot use a scalar value as an arrayUndefined variablewarning before the ErrorThe helper now checks for an undefined value only on the
falsepath, after the deprecation, and no longer reports an undefined key on the scalar path. The generated JIT code is unchanged, and the helper is slightly smaller at-O2(183 instructions instead of 207 on arm64).