From 7af4e6d02d678b9e31c192e8adfc3bb9d6277f5a Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Tue, 7 Jul 2015 19:21:02 +0800 Subject: [PATCH] Fixed bug #70006 (cli - function with default arg = STDOUT crash output). --- NEWS | 2 ++ Zend/zend_execute_API.c | 4 ---- sapi/cli/tests/bug70006.phpt | 18 ++++++++++++++++++ 3 files changed, 20 insertions(+), 4 deletions(-) create mode 100644 sapi/cli/tests/bug70006.phpt 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-- + +--FILE-- + +okey +--EXPECT-- +okey -- 2.50.1