Skip to content

Commit e1cb22a

Browse files
committed
Fix bug #69599
1 parent 33594b7 commit e1cb22a

File tree

4 files changed

+26
-4
lines changed

4 files changed

+26
-4
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ PHP NEWS
1919
(Nikita)
2020
. Fixed bug #69472 (php_sys_readlink ignores misc errors from
2121
GetFinalPathNameByHandleA). (Jan Starke)
22+
. Fixed bug #69599 (Strange generator+exception+variadic crash). (Nikita)
2223

2324
- Iconv:
2425
. Fixed bug #48147 (iconv with //IGNORE cuts the string). (Stas)

Zend/tests/bug69599.phpt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
--TEST--
2+
Bug #69599: Strange generator+exception+variadic crash
3+
--FILE--
4+
<?php
5+
6+
function crash() {
7+
sin(...[0]);
8+
throw new \Exception();
9+
yield;
10+
}
11+
12+
iterator_to_array(crash());
13+
14+
?>
15+
--EXPECTF--
16+
Fatal error: Uncaught exception 'Exception' in %s:%d
17+
Stack trace:
18+
#0 [internal function]: crash()
19+
#1 %s(%d): iterator_to_array(Object(Generator))
20+
#2 {main}
21+
thrown in %s on line %d

Zend/zend_vm_def.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1887,7 +1887,7 @@ ZEND_VM_HELPER(zend_leave_helper, ANY, ANY)
18871887

18881888
EX(call)--;
18891889

1890-
zend_vm_stack_clear_multiple(1 TSRMLS_CC);
1890+
zend_vm_stack_clear_multiple(0 TSRMLS_CC);
18911891

18921892
if (UNEXPECTED(EG(exception) != NULL)) {
18931893
zend_throw_exception_internal(NULL TSRMLS_CC);
@@ -2075,7 +2075,7 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
20752075

20762076
EX(call)--;
20772077

2078-
zend_vm_stack_clear_multiple(1 TSRMLS_CC);
2078+
zend_vm_stack_clear_multiple(0 TSRMLS_CC);
20792079

20802080
if (UNEXPECTED(EG(exception) != NULL)) {
20812081
zend_throw_exception_internal(NULL TSRMLS_CC);

Zend/zend_vm_execute.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ static int ZEND_FASTCALL zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS)
459459

460460
EX(call)--;
461461

462-
zend_vm_stack_clear_multiple(1 TSRMLS_CC);
462+
zend_vm_stack_clear_multiple(0 TSRMLS_CC);
463463

464464
if (UNEXPECTED(EG(exception) != NULL)) {
465465
zend_throw_exception_internal(NULL TSRMLS_CC);
@@ -647,7 +647,7 @@ static int ZEND_FASTCALL zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_AR
647647

648648
EX(call)--;
649649

650-
zend_vm_stack_clear_multiple(1 TSRMLS_CC);
650+
zend_vm_stack_clear_multiple(0 TSRMLS_CC);
651651

652652
if (UNEXPECTED(EG(exception) != NULL)) {
653653
zend_throw_exception_internal(NULL TSRMLS_CC);

0 commit comments

Comments
 (0)