Doc #70181 [NEW]: Missing information which confuses readers
| From: | emilxp at abv dot bg | Date: | Sat, 01 Aug 2015 16:32:47 +0000 |
| Subject: | Doc #70181 [NEW]: Missing information which confuses readers | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-12571@lists.php.net to get a copy of this message | ||
From: emilxp at abv dot bg
Operating system:
PHP version: Irrelevant
Package: Documentation problem
Bug Type: Documentation Problem
Bug description:Missing information which confuses readers
Description:
------------
---
From manual page:
http://php.net/manual/en/features.gc.refcounting-basics.php
---
I started reading the article at the page stated above and got confused
by the sentence "The "refcount" gets decreased by one when any symbol
linked to the variable container leaves the scope (e.g. when the
function ends) or when unset() is called on a symbol.".
I believe there's at least one more way to reduce the refcount and
that's by assignment.
I think that this missing information can confuse some people when they
first read it. I think it should be stated that reducing the refcount
can happen by making $a and/or $b reference to different zvals and
possibly other ways that I couldn't come up with.
Test script:
---------------
<?php
$a = "bla";
$b = $a;
// now $a and $b reference "bla"
xdebug_debug_zval('a');
xdebug_debug_zval('b');
$a = "this";
// show that the refcount decreases
xdebug_debug_zval('a');
xdebug_debug_zval('b');
$b = "some";
// now both $a and $b point to different zvals.
// the first "bla" zval must be food for the garbadge collector
xdebug_debug_zval('a');
xdebug_debug_zval('b');
--
Edit bug report at https://bugs.php.net/bug.php?id=70181&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=70181&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=70181&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=70181&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=70181&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=70181&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=70181&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=70181&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=70181&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=70181&r=support
Expected behavior: https://bugs.php.net/fix.php?id=70181&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=70181&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=70181&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=70181&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=70181&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=70181&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=70181&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=70181&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=70181&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=70181&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=70181&r=mysqlcfg