summaryrefslogtreecommitdiff
path: root/Zend
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2021-03-01 16:30:19 +0100
committerNikita Popov <nikita.ppv@gmail.com>2021-03-01 16:30:19 +0100
commit056eac6b038808999303b3fea6b949747807fb2d (patch)
tree9e502e3406851098e0459e498e169c51d83d62e0 /Zend
parent26c3fa275943e0e8bf8527b7ed1b3e68eecb72a1 (diff)
parent75a4f484f058f50fa1bb70c1eb5388409910203b (diff)
downloadphp-git-056eac6b038808999303b3fea6b949747807fb2d.tar.gz
Merge branch 'PHP-8.0'
* PHP-8.0: Fixed bug #80811
Diffstat (limited to 'Zend')
-rw-r--r--Zend/tests/bug80811.phpt19
-rw-r--r--Zend/zend_execute.c3
2 files changed, 22 insertions, 0 deletions
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 8245f47605..11a140e845 100644
--- a/Zend/zend_execute.c
+++ b/Zend/zend_execute.c
@@ -4595,6 +4595,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);
+ }
}
}