Doc #70181 [Opn->Csd]: Missing information which confuses readers

From: Date: Sat, 30 Jul 2016 00:10:11 +0000
Subject: Doc #70181 [Opn->Csd]: Missing information which confuses readers
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-13763@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=70181&edit=1 ID: 70181 Updated by: cmb@php.net Reported by: emilxp at abv dot bg Summary: Missing information which confuses readers -Status: Open +Status: Closed Type: Documentation Problem Package: Documentation problem PHP Version: Irrelevant -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: This bug has been fixed in the documentation's XML sources. Since the online and downloadable versions of the documentation need some time to get updated, we would like to ask you to be a bit patient. Thank you for the report, and for helping us make our documentation better. Previous Comments: ------------------------------------------------------------------------ [2016-07-30 00:09:25] cmb@php.net Automatic comment from SVN on behalf of cmb Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=339741 Log: Fix #70181: Missing information which confuses readers ------------------------------------------------------------------------ [2015-08-01 16:32:46] emilxp at abv dot bg 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 this bug report at https://bugs.php.net/bug.php?id=70181&edit=1

« previous php.doc.bugs (#13763) next »