Bug #74279 [Opn->Dup]: refcount is diffrent from php 5.6.25
| From: | requinix@php.net | Date: | Tue, 21 Mar 2017 04:36:57 +0000 |
| Subject: | Bug #74279 [Opn->Dup]: refcount is diffrent from php 5.6.25 | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-207968@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=74279&edit=1
ID: 74279
Updated by: requinix@php.net
Reported by: gang dot ji at 100dos dot com
Summary: refcount is diffrent from php 5.6.25
-Status: Open
+Status: Duplicate
Type: Bug
-Package: Performance problem
+Package: Variables related
Operating System: mac os 10.11.6
PHP Version: 7.1Git-2017-03-21 (Git)
Block user comment: N
Private report: N
New Comment:
debug_zval_dump's refcount was already a bit broken before PHP 7 came along: since call-time
pass-by-ref is not available, theoretically the refcount should always be 1 or 2, but that's
not terribly helpful. Then PHP 7 started making more changes to how variables move around.
Since 7.1.2 the example shows refcount(3), which is more useful but blatantly contradictory to the
docs. https://3v4l.org/ntX3A In PHP 5.6 it shows refcount(1)
which is less useful but agrees with the docs.
Two issues here, both covered in other bugs already:
1. Docs are incorrect - bug #72283
2. debug_zval_dump is simply not accurate anymore and something else should replace it - request
#67847
Previous Comments:
------------------------------------------------------------------------
[2017-03-21 04:16:42] gang dot ji at 100dos dot com
Description:
------------
tigerâ/opt/work/tmp» cat ref_count.php
[12:10:32]
<?php
$var1 = 'Hello World';
$var2 = '';
$var2 =& $var1;
debug_zval_dump($var1);
tigerâ/opt/work/tmp» php ref_count.php
[12:10:35]
string(11) "Hello World" refcount(3)
Test script:
---------------
tigerâ/opt/work/tmp» cat ref_count.php
[12:10:32]
<?php
$var1 = 'Hello World';
$var2 = '';
$var2 =& $var1;
debug_zval_dump($var1);
tigerâ/opt/work/tmp» php ref_count.php
[12:10:35]
string(11) "Hello World" refcount(3)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=74279&edit=1