Mantis Bugtracker

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0001963 [Quercus] minor always 08-22-07 14:43 09-04-07 11:09
Reporter rjc View Status public  
Assigned To nam
Priority normal Resolution fixed  
Status closed   Product Version 3.1.2
Summary 0001963: return new self(...) fails
MediaWiki's ability to upload images and files is broken by this.

In includes/filerepo/LocalFile.php, there are lots of static methods with code like "return new self(...)" these return a parse error in Resin 3.1.2

Trying to change this to "return new LocalFile(..)" fails with stack overflow/infinte loop.

This appears to be a common PHP idiom for singletons/factories.
Additional Information
Attached Files

- Relationships

- Notes
08-23-07 12:26

I temporarily fixed this by changing return new self(...) to return new (__CLASS__)(...) in all classes and subclasses in MediaWiki that used it, but I would appreciate fixing this, because I'd rather not patch the MediaWiki source to work with Quercus.
08-26-07 03:38

Seems to be a parser issue: for 'new self' (no parentheses) it works fine. Changing c.q.p.QuercusParser, lines 3036-3039 (SVN HEAD) to:

        if (!name.equals("self") && token == '(')
          return parseFunction(className, name, isInstantiated);
          return parseConstant(className, name);

works -- however seems more like a quick workaround.

+1 for fixing this as it is indeed a common (and perfectly legal) idiom, used e.g. by the Zend Framework frequently.
09-04-07 11:09


- Issue History
Date Modified Username Field Change
08-22-07 14:43 rjc New Issue
08-23-07 12:26 rjc Note Added: 0002227
08-26-07 03:38 kim Note Added: 0002236
09-04-07 11:09 nam Status new => assigned
09-04-07 11:09 nam Assigned To  => nam
09-04-07 11:09 nam Status assigned => closed
09-04-07 11:09 nam Note Added: 0002257
09-04-07 11:09 nam Resolution open => fixed
09-04-07 11:09 nam Fixed in Version  => 3.1.3

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