summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXinchen Hui <laruence@php.net>2015-07-07 19:21:02 +0800
committerXinchen Hui <laruence@php.net>2015-07-07 19:21:02 +0800
commit7af4e6d02d678b9e31c192e8adfc3bb9d6277f5a (patch)
treed5161b01fef6cb077a6adbb98095140fd1775a48
parent333528089e053b1db35a073955b3ec7244881667 (diff)
downloadphp-git-7af4e6d02d678b9e31c192e8adfc3bb9d6277f5a.tar.gz
Fixed bug #70006 (cli - function with default arg = STDOUT crash output).
-rw-r--r--NEWS2
-rw-r--r--Zend/zend_execute_API.c4
-rw-r--r--sapi/cli/tests/bug70006.phpt18
3 files changed, 20 insertions, 4 deletions
diff --git a/NEWS b/NEWS
index 365f0eefb0..5de290a5d2 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,8 @@ PHP NEWS
09 Jul 2015, PHP 7.0.0 Beta 1
- Core:
+ . Fixed bug #70006 (cli - function with default arg = STDOUT crash output).
+ (Laruence)
. Fixed bug #69521 (Segfault in gc_collect_cycles()).
(arjen at react dot com, Laruence)
. Improved zend_string API (Francois Laupretre)
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c
index fc92494a1d..29d06731e5 100644
--- a/Zend/zend_execute_API.c
+++ b/Zend/zend_execute_API.c
@@ -555,11 +555,9 @@ ZEND_API int zval_update_constant_ex(zval *p, zend_bool inline_change, zend_clas
zend_throw_error(zend_ce_error, "Cannot declare self-referencing constant '%s'", Z_STRVAL_P(p));
return FAILURE;
} else if (Z_TYPE_P(p) == IS_CONSTANT) {
- int refcount;
SEPARATE_ZVAL_NOREF(p);
MARK_CONSTANT_VISITED(p);
- refcount = Z_REFCOUNTED_P(p) ? Z_REFCOUNT_P(p) : 1;
if (Z_CONST_FLAGS_P(p) & IS_CONSTANT_CLASS) {
ZEND_ASSERT(EG(current_execute_data));
if (inline_change) {
@@ -639,8 +637,6 @@ ZEND_API int zval_update_constant_ex(zval *p, zend_bool inline_change, zend_clas
}
zval_opt_copy_ctor(p);
}
-
- if (Z_REFCOUNTED_P(p)) Z_SET_REFCOUNT_P(p, refcount);
} else if (Z_TYPE_P(p) == IS_CONSTANT_AST) {
zval tmp;
diff --git a/sapi/cli/tests/bug70006.phpt b/sapi/cli/tests/bug70006.phpt
new file mode 100644
index 0000000000..855c9e1f80
--- /dev/null
+++ b/sapi/cli/tests/bug70006.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Bug #70006 (cli - function with default arg = STDOUT crash output)
+--SKIPIF--
+<?php
+include "skipif.inc";
+?>
+--FILE--
+<?php
+
+function foo1($stream = STDOUT)
+{
+ //do nothing
+}
+foo1();
+?>
+okey
+--EXPECT--
+okey