Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0002550 [Quercus] minor have not tried 03-24-08 15:47 05-12-08 17:19
Reporter mardala View Status public  
Assigned To ferg
Priority normal Resolution fixed  
Status closed   Product Version 3.1.3
Summary 0002550: PHP5 singleton example not working the same as Apache module php 5
Description given something like this:

class Singleton {
  // object instance
  private static $instance;
 
  private function __construct() {}
 
  public static function getInstance() {
    if (self::$instance === null) self::$instance = new self;
    return self::$instance;
  }
 
  public function doAction() {
    ...
  }
}

This will not work. Quercus throws an exception (com.caucho.quercus.QuercusException: no matching class self) on "new self;" ... the fix is "new Singleton();"

Not a show stopper by anymeans at all, but just a subtle difference than php on apache.
Additional Information I did a quick search of singleton in Quercus and didn't see anything so I hope this is not a dupe.
Attached Files

- Relationships

- Notes
(0002889)
mardala
03-24-08 16:00

self(); works. I just found out. Also this works: $c = __CLASS__, self::$instance = new $c;
 
(0003058)
ferg
05-12-08 17:19

php/0957, php/3957
 

- Issue History
Date Modified Username Field Change
03-24-08 15:47 mardala New Issue
03-24-08 16:00 mardala Note Added: 0002889
05-12-08 17:19 ferg Note Added: 0003058
05-12-08 17:19 ferg Assigned To  => ferg
05-12-08 17:19 ferg Status new => closed
05-12-08 17:19 ferg Resolution open => fixed
05-12-08 17:19 ferg Fixed in Version  => 3.2.0


Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
31 total queries executed.
27 unique queries executed.
Powered by Mantis Bugtracker