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

Fixed compatibility with PHP 8.2+ #638

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

mikhainin
Copy link
Contributor

It looks like 8.2 does not accept "tentative" void type

@mikhainin
Copy link
Contributor Author

When PHP8.2 built with --enable-debug --enable-debug-assertions, the test ./tests/292_index_iterator.phpt fails with:

php: /build/php.git/Zend/zend_execute_API.c:974: zend_call_function: Assertion `!(call->func->common.fn_flags & (1 << 13)) || zend_verify_internal_return_type(call->func, fci->retval)' failed.
(gdb) bt
#0  0x00007fe217a3dacf in raise () from /lib64/libc.so.6
#1  0x00007fe217a10ea5 in abort () from /lib64/libc.so.6
#2  0x00007fe217a10d79 in __assert_fail_base.cold.0 () from /lib64/libc.so.6
#3  0x00007fe217a36426 in __assert_fail () from /lib64/libc.so.6
#4  0x00000000008651e9 in zend_call_function (fci=0x7ffe14fcc770, fci_cache=0x7ffe14fcc750) at /build/php.git/Zend/zend_execute_API.c:973
#5  0x0000000000865502 in zend_call_known_function (fn=0x1a63070, object=0x1ac0308, called_scope=0x1a433e0, retval_ptr=0x0, param_count=0, params=0x0, named_params=0x0)
    at /build/php.git/Zend/zend_execute_API.c:1044
#6  0x000000000093d802 in zend_call_known_instance_method (fn=0x1a63070, object=0x1ac0308, retval_ptr=0x0, param_count=0, params=0x0) at /build/php.git/Zend/zend_API.h:753
#7  0x000000000093d83c in zend_call_known_instance_method_with_0_params (fn=0x1a63070, object=0x1ac0308, retval_ptr=0x0) at /build/php.git/Zend/zend_API.h:759
#8  0x000000000093e397 in zend_user_it_rewind (_iter=0x1b078c0) at /build/php.git/Zend/zend_interfaces.c:180
#9  0x00000000008bb00e in zend_fe_reset_iterator (array_ptr=0x7fe21a863090, by_ref=0) at /build/php.git/Zend/zend_execute.c:4843
#10 0x000000000091438f in ZEND_FE_RESET_R_SPEC_CV_HANDLER () at /build/php.git/Zend/zend_vm_execute.h:39090
#11 0x00000000009368f6 in execute_ex (ex=0x7fe21a863030) at /build/php.git/Zend/zend_vm_execute.h:59428
#12 0x00000000009378b7 in zend_execute (op_array=0x1ac0cb0, return_value=0x0) at /build/php.git/Zend/zend_vm_execute.h:60425
#13 0x000000000087f113 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /build/php.git/Zend/zend.c:2029
#14 0x00000000007d7ac8 in php_execute_script (primary_file=0x7ffe14fce0f0) at /build/php.git/main/main.c:2557
#15 0x00000000009f0997 in do_cli (argc=82, argv=0x19021c0) at /build/php.git/sapi/cli/php_cli.c:964
#16 0x00000000009f1640 in main (argc=82, argv=0x19021c0) at /build/php.git/sapi/cli/php_cli.c:1337
(gdb) f 6
#6  0x000000000093d802 in zend_call_known_instance_method (fn=0x1a63070, object=0x1ac0308, retval_ptr=0x0, param_count=0, params=0x0) at /build/php.git/Zend/zend_API.h:753
753	/build/php.git/Zend/zend_API.h: No such file or directory.
(gdb) p fn
$1 = (zend_function *) 0x1a63070
(gdb) p *fn
$2 = {type = 1 '\001', quick_arg_flags = 1, common = {type = 1 '\001', arg_flags = "\000\000", fn_flags = 8193, function_name = 0x197d0d0, scope = 0x1a433e0, prototype = 0x1997220, num_args = 0, 
    required_num_args = 0, arg_info = 0x1a63120, attributes = 0x0, T = 0, run_time_cache__ptr = 0x4471}, op_array = {type = 1 '\001', arg_flags = "\000\000", fn_flags = 8193, function_name = 0x197d0d0, 
    scope = 0x1a433e0, prototype = 0x1997220, num_args = 0, required_num_args = 0, arg_info = 0x1a63120, attributes = 0x0, T = 0, run_time_cache__ptr = 0x4471, cache_size = 389504679, last_var = 32738, 
    last = 391866336, opcodes = 0x0, static_variables_ptr__ptr = 0x0, static_variables = 0x0, vars = 0x0, refcount = 0x0, last_live_range = 0, last_try_catch = 0, live_range = 0x31, try_catch_array = 0x0, 
    filename = 0x0, line_start = 536887296, line_end = 0, doc_comment = 0x0, last_literal = 0, num_dynamic_func_defs = 0, literals = 0x91, dynamic_func_defs = 0x200100000001, reserved = {0x1997130, 0x1a433e0, 
      0x1997160, 0x0, 0x1a631e0, 0x0}}, internal_function = {type = 1 '\001', arg_flags = "\000\000", fn_flags = 8193, function_name = 0x197d0d0, scope = 0x1a433e0, prototype = 0x1997220, num_args = 0, 
    required_num_args = 0, arg_info = 0x1a63120, attributes = 0x0, T = 0, run_time_cache__ptr = 0x4471, handler = 0x7fe217375ea7 <zim_Imagick_setFirstIterator>, module = 0x7fe2175b67e0 <imagick_module_entry>, 
    reserved = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0}}}

It looks like the "tentative" return type doesn't work in this case. I thought, that it would be easier just to define the method that corresponds the interface

@mikhainin
Copy link
Contributor Author

It may be worth adding 8.2 and 8.3 in the test runner...

@mikhainin mikhainin force-pushed the php8.2-fix branch 2 times, most recently from 51d1097 to 47da661 Compare November 13, 2023 14:01
It looks like 8.2 does not accept "tentative" void type
@remicollet
Copy link
Contributor

@mikhainin have you tried PR #616 ?

@mikhainin
Copy link
Contributor Author

Actually, no. I'm afraid I didn't see that one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants