Missing initial value of static locals in trait methods

Bug #55825 Missing initial value of static locals in trait methods
Submitted: 2011-09-30 22:18 UTC Modified: 2011-10-03 17:03 UTC
From: ottoni at fb dot com Assigned: laruence (profile)
Status: Closed Package: *General Issues
PHP Version: 5.4SVN-2011-09-30 (snap) OS: Linux
Private report: No CVE-ID: None

 [2011-09-30 22:18 UTC] 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


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports