|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2015-07-07 09:21 UTC] simon dot minotto at gmail dot com
Description:
------------
using php in cli mode
With following code :
<?php
function foo1($stream = STDOUT)
{
//do nothing
}
echo "before\n";
foo1();
echo "after\n";
Excepted result : display
before
after
Result with php7 :
before
Work fine with php 5.X
azureuser@php7test1:/mnt/eztv$ php -v
PHP 7.0.0alpha2 (cli) (built: Jul 7 2015 04:58:33)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v3.0.0-dev, Copyright (c) 1998-2015 Zend Technologies
'./configure' '--with-apxs2=/usr/bin/apxs' '--with-mysqli' '--enable-soap' '--enable-sockets' '--enable-sysvsem' '--with-xsl' '--enable-zip' '--enable-mbstring' '--with-curl' '--with-mcrypt' '--enable-ftp' '--with-gd' '--with-jpeg-dir=/usr/lib' '--enable-exif' '--with-openssl' '--enable-pcntl'
Test script:
---------------
<?php
function foo1($stream = STDOUT)
{
//do nothing
}
echo "before\n";
foo1();
echo "after\n";
Excepted result : display
before
after
Expected result:
----------------
before
after
Actual result:
--------------
before
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 09:00:01 2025 UTC |
an quick fix is: diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index fc92494..1386c95 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) { @@ -640,7 +638,7 @@ 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); + /* if (Z_REFCOUNTED_P(p)) Z_SET_REFCOUNT_P(p, refcount); */ } else if (Z_TYPE_P(p) == IS_CONSTANT_AST) { zval tmp; however I am not sure why SET_REFCOUNT_P here..