Skip to content

Commit b3e26c3

Browse files
committed
Fix missing handling of CALLABLE_CONVERT in cleanup_unfinished_calls()
Fixes phpGH-14003
1 parent 04b864e commit b3e26c3

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ PHP NEWS
99
Zend/zend_opcode.c). (nielsdos)
1010
. Fixed bug GH-13942 (Align the behavior of zend-max-execution-timers with
1111
other timeout implementations). (Kévin Dunglas)
12+
. Fixed bug GH-14003 (Broken cleanup of unfinished calls with callable convert
13+
parameters). (ilutov)
1214

1315
- Fibers:
1416
. Fixed bug GH-13903 (ASAN false positive underflow when executing copy()).

Zend/tests/gh14003.phpt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
--TEST--
2+
GH-14003: Missing handling of CALLABLE_CONVERT in cleanup_unfinished_calls()
3+
--FILE--
4+
<?php
5+
6+
function foo(string $key): string {
7+
throw new \Exception('Test');
8+
}
9+
10+
array_filter(
11+
array_combine(
12+
['a'],
13+
array_map(foo(...), ['a']),
14+
),
15+
);
16+
17+
?>
18+
--EXPECTF--
19+
Fatal error: Uncaught Exception: Test in %s:%d
20+
Stack trace:
21+
#0 [internal function]: foo('a')
22+
#1 %s(%d): array_map(Object(Closure), Array)
23+
#2 {main}
24+
thrown in %s on line %d

Zend/zend_execute.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4104,6 +4104,7 @@ ZEND_API void zend_unfinished_calls_gc(zend_execute_data *execute_data, zend_exe
41044104
case ZEND_DO_ICALL:
41054105
case ZEND_DO_UCALL:
41064106
case ZEND_DO_FCALL_BY_NAME:
4107+
case ZEND_CALLABLE_CONVERT:
41074108
level++;
41084109
break;
41094110
case ZEND_INIT_FCALL:
@@ -4159,6 +4160,7 @@ ZEND_API void zend_unfinished_calls_gc(zend_execute_data *execute_data, zend_exe
41594160
case ZEND_DO_ICALL:
41604161
case ZEND_DO_UCALL:
41614162
case ZEND_DO_FCALL_BY_NAME:
4163+
case ZEND_CALLABLE_CONVERT:
41624164
level++;
41634165
break;
41644166
case ZEND_INIT_FCALL:
@@ -4237,6 +4239,7 @@ static void cleanup_unfinished_calls(zend_execute_data *execute_data, uint32_t o
42374239
case ZEND_DO_ICALL:
42384240
case ZEND_DO_UCALL:
42394241
case ZEND_DO_FCALL_BY_NAME:
4242+
case ZEND_CALLABLE_CONVERT:
42404243
level++;
42414244
break;
42424245
case ZEND_INIT_FCALL:
@@ -4292,6 +4295,7 @@ static void cleanup_unfinished_calls(zend_execute_data *execute_data, uint32_t o
42924295
case ZEND_DO_ICALL:
42934296
case ZEND_DO_UCALL:
42944297
case ZEND_DO_FCALL_BY_NAME:
4298+
case ZEND_CALLABLE_CONVERT:
42954299
level++;
42964300
break;
42974301
case ZEND_INIT_FCALL:

0 commit comments

Comments
 (0)