diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2021-03-01 15:01:09 +0100 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2021-03-01 16:30:01 +0100 |
commit | 75a4f484f058f50fa1bb70c1eb5388409910203b (patch) | |
tree | 8974668778474a0be9842ac898904dac974559c1 | |
parent | 5875bf754ed4fc64a6f0b7d62734d2a816c51017 (diff) | |
download | php-git-75a4f484f058f50fa1bb70c1eb5388409910203b.tar.gz |
Fixed bug #80811
When filling in defaults for skipped params, make sure that
reference parameters get the expected reference wrapper.
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | Zend/tests/bug80811.phpt | 19 | ||||
-rw-r--r-- | Zend/zend_execute.c | 3 |
3 files changed, 24 insertions, 0 deletions
@@ -4,6 +4,8 @@ PHP NEWS - Core: . Fixed bug #75776 (Flushing streams with compression filter is broken). (cmb) + . Fixed bug #80811 (Function exec without $output but with $restult_code + parameter crashes). (Nikita) - IMAP: . Fixed bug #80800 (imap_open() fails when the flags parameter includes diff --git a/Zend/tests/bug80811.phpt b/Zend/tests/bug80811.phpt new file mode 100644 index 0000000000..e9f6443db1 --- /dev/null +++ b/Zend/tests/bug80811.phpt @@ -0,0 +1,19 @@ +--TEST-- +Bug #80811: Function exec without $output but with $restult_code parameter crashes +--FILE-- +<?php + +echo 'Executing with all params:' . PHP_EOL; +exec('echo Something', output: $output, result_code: $resultCode); +var_dump($resultCode); + +echo 'Executing without output param:' . PHP_EOL; +exec('echo Something', result_code: $resultCode); +var_dump($resultCode); + +?> +--EXPECT-- +Executing with all params: +int(0) +Executing without output param: +int(0) diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index f6b2a6f9be..69b0fb5242 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -4579,6 +4579,9 @@ ZEND_API zend_result ZEND_FASTCALL zend_handle_undef_args(zend_execute_data *cal } ZVAL_COPY_VALUE(arg, &default_value); + if (ZEND_ARG_SEND_MODE(arg_info) & ZEND_SEND_BY_REF) { + ZVAL_NEW_REF(arg, arg); + } } } |