Bug #55825 [Asn->Csd]: Missing initial value of static locals in trait methods

From: Date: Mon, 03 Oct 2011 17:03:23 +0000
Subject: Bug #55825 [Asn->Csd]: Missing initial value of static locals in trait methods
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-164060@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=55825&edit=1 ID: 55825 Updated by: laruence@php.net Reported by: ottoni at fb dot com Summary: Missing initial value of static locals in trait methods -Status: Assigned +Status: Closed Type: Bug Package: *General Issues Operating System: Linux PHP Version: 5.4SVN-2011-09-30 (snap) Assigned To: laruence Block user comment: N Private report: N New Comment: This bug has been fixed in SVN. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. For Windows: http://windows.php.net/snapshots/ Thank you for the report, and for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2011-10-03 17:00:56] laruence@php.net Automatic comment from SVN on behalf of laruence Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=317672 Log: Fixed bug #55825, and add test script ------------------------------------------------------------------------ [2011-09-30 22:18:50] ottoni at fb dot com Description: ------------ The initial value of static locals inside trait methods is being lost. Test script: --------------- <?php trait T1 { public function inc() { static $x=1; echo $x++ . "\n"; } } class C { use T1; } $c1 = new C; $c1->inc(); $c1->inc(); Expected result: ---------------- 1 2 Actual result: -------------- 1 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=55825&edit=1

« previous php.bugs (#164060) next »