Skip to content

Commit 056eac6

Browse files
committed
Merge branch 'PHP-8.0'
* PHP-8.0: Fixed bug #80811
2 parents 26c3fa2 + 75a4f48 commit 056eac6

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

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
@@ -4595,6 +4595,9 @@ ZEND_API zend_result ZEND_FASTCALL zend_handle_undef_args(zend_execute_data *cal
45954595
}
45964596

45974597
ZVAL_COPY_VALUE(arg, &default_value);
4598+
if (ZEND_ARG_SEND_MODE(arg_info) & ZEND_SEND_BY_REF) {
4599+
ZVAL_NEW_REF(arg, arg);
4600+
}
45984601
}
45994602
}
46004603

0 commit comments

Comments
 (0)