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
{{ message }}
Repository navigation
Assertion failure with ext/date DateInterval property hash construction #20503
#0 __pthread_kill_implementation (threadid=<optimized out>, signo=6, no_tid=0) at ./nptl/pthread_kill.c:44#1 __pthread_kill_internal (threadid=<optimized out>, signo=6) at ./nptl/pthread_kill.c:89#2 __GI___pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ./nptl/pthread_kill.c:100#3 0x00007ffff6845e2e in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26#4 0x00007ffff6828888 in __GI_abort () at ./stdlib/abort.c:77#5 0x00007ffff68287f0 in __assert_fail_base (fmt=<optimized out>, assertion=<optimized out>, file=<optimized out>, line=<optimized out>, function=<optimized out>) at ./assert/assert.c:118#6 0x000055555e1d3f45 in _zend_hash_str_add_or_update_i (ht=0x7bfff284c8a0, str=0x55555eafc8c0 <str> "y", len=1, h=9223372036854953502, pData=0x7bfff3952520, flag=1)
at /home/dcarlier/Contribs/php-src/Zend/zend_hash.c:912
#7 0x000055555e1d3c70 in zend_hash_str_update (ht=0x7bfff284c8a0, str=0x55555eafc8c0 <str> "y", len=1, pData=0x7bfff3952520) at /home/dcarlier/Contribs/php-src/Zend/zend_hash.c:1041#8 0x0000555558b73163 in date_interval_object_to_hash (intervalobj=0x7bfff284c780, props=0x7bfff284c8a0) at /home/dcarlier/Contribs/php-src/ext/date/php_date.c:2179#9 0x0000555558baf920 in date_object_get_properties_interval (object=0x7bfff284c798) at /home/dcarlier/Contribs/php-src/ext/date/php_date.c:2211#10 0x000055555e5137df in zend_std_get_properties_for (obj=0x7bfff284c798, purpose=ZEND_PROP_PURPOSE_JSON) at /home/dcarlier/Contribs/php-src/Zend/zend_object_handlers.c:2508#11 0x000055555e514007 in zend_get_properties_for (obj=0x7bfff3952460, purpose=ZEND_PROP_PURPOSE_JSON) at /home/dcarlier/Contribs/php-src/Zend/zend_object_handlers.c:2544#12 0x0000555559b1b809 in php_json_encode_array (buf=0x7bfff3b0b660, val=0x7bfff3952460, options=0, encoder=0x7bfff3b0b640) at /home/dcarlier/Contribs/php-src/ext/json/json_encoder.c:209#13 0x0000555559b17596 in php_json_encode_zval (buf=0x7bfff3b0b660, val=0x7bfff284d258, options=0, encoder=0x7bfff3b0b640) at /home/dcarlier/Contribs/php-src/ext/json/json_encoder.c:668#14 0x0000555559b1dbe1 in php_json_encode_array (buf=0x7bfff3b0b660, val=0x7bfff39523e0, options=0, encoder=0x7bfff3b0b640) at /home/dcarlier/Contribs/php-src/ext/json/json_encoder.c:301#15 0x0000555559b17596 in php_json_encode_zval (buf=0x7bfff3b0b660, val=0x7bfff2874080, options=0, encoder=0x7bfff3b0b640) at /home/dcarlier/Contribs/php-src/ext/json/json_encoder.c:668#16 0x0000555559b1dbe1 in php_json_encode_array (buf=0x7bfff3b0b660, val=0x7bfff39522e0, options=0, encoder=0x7bfff3b0b640) at /home/dcarlier/Contribs/php-src/ext/json/json_encoder.c:301#17 0x0000555559b17596 in php_json_encode_zval (buf=0x7bfff3b0b660, val=0x7bfff28717c0, options=0, encoder=0x7bfff3b0b640) at /home/dcarlier/Contribs/php-src/ext/json/json_encoder.c:668#18 0x0000555559b1dbe1 in php_json_encode_array (buf=0x7bfff3b0b660, val=0x7bfff3952260, options=0, encoder=0x7bfff3b0b640) at /home/dcarlier/Contribs/php-src/ext/json/json_encoder.c:301#19 0x0000555559b17596 in php_json_encode_zval (buf=0x7bfff3b0b660, val=0x7bfff2801fc8, options=0, encoder=0x7bfff3b0b640) at /home/dcarlier/Contribs/php-src/ext/json/json_encoder.c:668#20 0x0000555559b1dbe1 in php_json_encode_array (buf=0x7bfff3b0b660, val=0x7bfff39521e0, options=0, encoder=0x7bfff3b0b640) at /home/dcarlier/Contribs/php-src/ext/json/json_encoder.c:301#21 0x0000555559b17596 in php_json_encode_zval (buf=0x7bfff3b0b660, val=0x7bfff28073f0, options=0, encoder=0x7bfff3b0b640) at /home/dcarlier/Contribs/php-src/ext/json/json_encoder.c:668#22 0x0000555559b479b9 in zif_json_encode (execute_data=0x7bfff28073a0, return_value=0x7bfff2807280) at /home/dcarlier/Contribs/php-src/ext/json/json.c:237#23 0x000055555dea1d62 in ZEND_DO_ICALL_SPEC_RETVAL_USED_TAILCALL_HANDLER (execute_data=0x7bfff2807020, opline=0x7bfff284f3a8) at Zend/zend_vm_execute.h:57205#24 0x000055555d43239f in execute_ex (ex=0x7bfff2807020) at Zend/zend_vm_execute.h:116212#25 0x000055555d43441f in zend_execute (op_array=0x7bfff2889000, return_value=0x0) at Zend/zend_vm_execute.h:121924#26 0x000055555e655620 in zend_execute_script (type=8, retval=0x0, file_handle=0x7fffffffc2c0) at /home/dcarlier/Contribs/php-src/Zend/zend.c:1975#27 0x000055555cb0e303 in php_execute_script_ex (primary_file=0x7fffffffc2c0, retval=0x0) at /home/dcarlier/Contribs/php-src/main/main.c:2645#28 0x000055555cb0f1e9 in php_execute_script (primary_file=0x7fffffffc2c0) at /home/dcarlier/Contribs/php-src/main/main.c:2685#29 0x000055555e666eef in do_cli (argc=2, argv=0x7c2ff4de1ba0) at /home/dcarlier/Contribs/php-src/sapi/cli/php_cli.c:951#30 0x000055555e662e92 in main (argc=2, argv=0x7c2ff4de1ba0) at /home/dcarlier/Contribs/php-src/sapi/cli/php_cli.c:1362
changed the title [-]Assertion failure in _zend_hash_str_add_or_update_i triggered by invalid array/dynamic property manipulation during JSON encoding[/-][+]Assertion failure with ext/date DateInterval property hash construction[/+]on Nov 16, 2025
The problem is that by assigning the object to itself we create a cycle and therefore a property table with a refcount>1.
Then the get_properties handler tries to add the internal keys to it and it fails the RC1 assertion.
The handler shouldn't modify the original properties table anyway. The following would fix this. However it only works on 8.4+ and not on 8.3 so I still have to figure out why that is:
Activity
devnexen commentedon Nov 16, 2025
ndossche commentedon Nov 16, 2025
Reduction:
[-]Assertion failure in _zend_hash_str_add_or_update_i triggered by invalid array/dynamic property manipulation during JSON encoding[/-][+]Assertion failure with ext/date DateInterval property hash construction[/+]ndossche commentedon Nov 16, 2025
The problem is that by assigning the object to itself we create a cycle and therefore a property table with a refcount>1.
Then the get_properties handler tries to add the internal keys to it and it fails the RC1 assertion.
The handler shouldn't modify the original properties table anyway. The following would fix this. However it only works on 8.4+ and not on 8.3 so I still have to figure out why that is:
EDIT: bisect reveals that 780a828 makes it work on 8.4... But that's a lot of code to sift through...
Fix phpGH-20503: Assertion failure with ext/date DateInterval propert…
Merge remote-tracking branch 'up/PHP-8.4' into fix-phpgh-20503
Fix phpGH-20503: Assertion failure with ext/date DateInterval propert…
Fix GH-20503: Assertion failure with ext/date DateInterval property h…
Merge branch 'PHP-8.4' into PHP-8.5
Merge branch 'PHP-8.5' into PHP-8.6
Merge branch 'PHP-8.6'