Skip to content

Commit 75a4f48

Browse files
committed
Fixed bug #80811
When filling in defaults for skipped params, make sure that reference parameters get the expected reference wrapper.
1 parent 5875bf7 commit 75a4f48

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ PHP NEWS
44

55
- Core:
66
. Fixed bug #75776 (Flushing streams with compression filter is broken). (cmb)
7+
. Fixed bug #80811 (Function exec without $output but with $restult_code
8+
parameter crashes). (Nikita)
79

810
- IMAP:
911
. Fixed bug #80800 (imap_open() fails when the flags parameter includes

Zend/tests/bug80811.phpt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
--TEST--
2+
Bug #80811: Function exec without $output but with $restult_code parameter crashes
3+
--FILE--
4+
<?php
5+
6+
echo 'Executing with all params:' . PHP_EOL;
7+
exec('echo Something', output: $output, result_code: $resultCode);
8+
var_dump($resultCode);
9+
10+
echo 'Executing without output param:' . PHP_EOL;
11+
exec('echo Something', result_code: $resultCode);
12+
var_dump($resultCode);
13+
14+
?>
15+
--EXPECT--
16+
Executing with all params:
17+
int(0)
18+
Executing without output param:
19+
int(0)

Zend/zend_execute.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4579,6 +4579,9 @@ ZEND_API zend_result ZEND_FASTCALL zend_handle_undef_args(zend_execute_data *cal
45794579
}
45804580

45814581
ZVAL_COPY_VALUE(arg, &default_value);
4582+
if (ZEND_ARG_SEND_MODE(arg_info) & ZEND_SEND_BY_REF) {
4583+
ZVAL_NEW_REF(arg, arg);
4584+
}
45824585
}
45834586
}
45844587

0 commit comments

Comments
 (0)