Skip to content
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

Iterating on ResourceBundle (using keys) causes segmentation fault #17317

Open
KidFlo opened this issue Jan 1, 2025 · 0 comments · May be fixed by #17323
Open

Iterating on ResourceBundle (using keys) causes segmentation fault #17317

KidFlo opened this issue Jan 1, 2025 · 0 comments · May be fixed by #17323

Comments

@KidFlo
Copy link

KidFlo commented Jan 1, 2025

Description

The following code:

<?php
foreach ((new ResourceBundle('', NULL))->get('calendar')->get('buddhist') as $key => $value)
    ;

Resulted in:

(segfault)

But I expected:

(no segfault)

On my Windows machine (ICU 75.1), but not only (apparently).

Details
php_intl!resourcebundle_iterator_key+39 [D:\a\php-ftw\php-ftw\php\vs16\x64\php-8.4.1\ext\intl\resourcebundle\resourcebundle_iterator.c @ 107 + e]     0000193`c365e280     0000193`c36900c0     0000000`00130000     0000000`00000000   D:\a\php-ftw\php-ftw\php\vs16\x64\php-8.4.1\ext\intl\resourcebundle\resourcebundle_iterator.c @ 107 + e 
php8!zend_fe_fetch_object_helper_SPEC+e6 [D:\a\php-ftw\php-ftw\php\vs16\x64\php-8.4.1\Zend\zend_vm_execute.h @ 2981]     0000000`00000000     0000000`00000001     0000000`00000000     0000193`c36142e0   D:\a\php-ftw\php-ftw\php\vs16\x64\php-8.4.1\Zend\zend_vm_execute.h @ 2981 
php8!ZEND_FE_FETCH_R_SPEC_VAR_HANDLER+25 [D:\a\php-ftw\php-ftw\php\vs16\x64\php-8.4.1\Zend\zend_vm_execute.h @ 23002 + 8]     0000193`c3614400     0000193`c36142e0     0000000`00000000     0000000`00130000   D:\a\php-ftw\php-ftw\php\vs16\x64\php-8.4.1\Zend\zend_vm_execute.h @ 23002 + 8 
php8!execute_ex+4f [D:\a\php-ftw\php-ftw\php\vs16\x64\php-8.4.1\Zend\zend_vm_execute.h @ 58584 + f]     0000000`00000000     0000000`00000000     000e820`678f0d01     0000193`c1770150   D:\a\php-ftw\php-ftw\php\vs16\x64\php-8.4.1\Zend\zend_vm_execute.h @ 58584 + f 
php8!zend_execute+140 [D:\a\php-ftw\php-ftw\php\vs16\x64\php-8.4.1\Zend\zend_vm_execute.h @ 64238]     6328a15`6eea3000     0000193`c3602400     0000193`c366a180     0000000`00000000   D:\a\php-ftw\php-ftw\php\vs16\x64\php-8.4.1\Zend\zend_vm_execute.h @ 64238 
php8!zend_execute_script+201 [D:\a\php-ftw\php-ftw\php\vs16\x64\php-8.4.1\Zend\zend.c @ 1935]     0000000`00000000     0000000`00000000     000008c`223fd0d0     0000193`c3602418   D:\a\php-ftw\php-ftw\php\vs16\x64\php-8.4.1\Zend\zend.c @ 1935 
php8!php_execute_script_ex+277 [D:\a\php-ftw\php-ftw\php\vs16\x64\php-8.4.1\main\main.c @ 2574 + 14]     0000000`00000002     0000000`00000000     0000000`00000002     0000000`00000005   D:\a\php-ftw\php-ftw\php\vs16\x64\php-8.4.1\main\main.c @ 2574 + 14 
php!do_cli+c28 [D:\a\php-ftw\php-ftw\php\vs16\x64\php-8.4.1\sapi\cli\php_cli.c @ 937]     0000000`00000005     0000000`00000004     0000000`00000005     0000193`c585cec0   D:\a\php-ftw\php-ftw\php\vs16\x64\php-8.4.1\sapi\cli\php_cli.c @ 937 
php!main+401 [D:\a\php-ftw\php-ftw\php\vs16\x64\php-8.4.1\sapi\cli\php_cli.c @ 1310 + 5]     0000000`00000000     0007ff7`ec55c529     0000193`c177dc80     0000000`00000000   D:\a\php-ftw\php-ftw\php\vs16\x64\php-8.4.1\sapi\cli\php_cli.c @ 1310 + 5 
php!__scrt_common_main_seh+10c [D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl @ 288 + 22]     0000000`00000000     0000000`00000000     0000000`00000000     0000000`00000000   D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl @ 288 + 22 
kernel32!BaseThreadInitThunk+1d     0000000`00000000     0000000`00000000     0000000`00000000     0000000`00000000    
ntdll!RtlUserThreadStart+28 

PHP Version

PHP 8.4.1

Operating System

No response

@devnexen devnexen self-assigned this Jan 1, 2025
devnexen added a commit to devnexen/php-src that referenced this issue Jan 1, 2025
devnexen added a commit to devnexen/php-src that referenced this issue Jan 1, 2025
nielsdos added a commit to nielsdos/php-src that referenced this issue Jan 2, 2025
The next() and rewind() calls should be the ones fetching the data.
We skip holes in the resource bundle in the same way that holes in
arrays are skipped.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment