Mantis - Quercus
Viewing Issue Advanced Details
3225 major always 01-06-09 23:29 01-12-09 18:37
closed 4.0.0  
none 4.0.0  
0003225: Method static is getting reset
I haven't been able to isolate this, so no self-contained test case for this one, but we have the following code:

class ABC {
  public static function getResponse() {
    static $response = null;
    if ($response === null) {
      error_log('Making new response');
      $response = new ABCResponse();
    return $response;

This is supposed to return a singleton instance of ABCResponse, and it does in regular PHP. But in Quercus -- and I believe this is a recent behavior change, though I don't know exactly when it changed -- I see the "Making new response" log message twice in a single request. However, this method is called more than twice, so the static variable is not *always* getting reset.

If it matters, one of the calls to this that causes the log message is from a non-static method of another class, while the other is from a function. This class, the other class, and the function are all in separate source files. But that set of conditions alone doesn't seem to be sufficient to trigger the bug. This class has no subclasses.

01-12-09 18:37   
php/0249, php/3249