Edit report at https://bugs.php.net/bug.php?id=55825&edit=1
ID: 55825 Updated by: [email protected] 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] [email protected] Automatic comment from SVN on behalf of laruence Revision: http://svn.php.net/viewvc/?view=revision&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
