Mantis - Quercus
|
|||||
Viewing Issue Advanced Details | |||||
|
|||||
ID: | Category: | Severity: | Reproducibility: | Date Submitted: | Last Update: |
1247 | minor | always | 07-12-06 06:30 | 03-21-07 10:51 | |
|
|||||
Reporter: | rikus | Platform: | |||
Assigned To: | nam | OS: | |||
Priority: | normal | OS Version: | |||
Status: | closed | Product Version: | |||
Product Build: | Resolution: | fixed | |||
Projection: | none | ||||
ETA: | none | Fixed in Version: | 3.1.1 | ||
|
|||||
Summary: | 0001247: const and static field access is not possible from declaration of static fields | ||||
Description: |
When trying to access static fields during initialization of the class quercus ends up trying to load the class again and again (?) Or if you try to access self::some_static_or_const_field during the same time you get an error stating that there is no such class "self" tried this in: resin-3_0-snap.tar.gz (2006/07/05) Please look below for examples... <?php //File: crash.php abstract class MyClass { const ONE = 1; const TWO = 2; const THREE = 6; protected static $affixMap = array( MyClass::ONE => 'Number 1', MyClass::TWO => 'Number 2', MyClass::THREE => 'Number 3' ); } abstract class MyClass2 { public static $ONE = 1; public static $TWO = 2; public static $THREE = 6; protected static $affixMap = array( MyClass2::ONE => 'Number 1', MyClass2::TWO => 'Number 2', MyClass2::THREE => 'Number 3' ); } abstract class MyClass3 { const ONE = 1; const TWO = 2; const THREE = 6; protected static $affixMap = array( self::ONE => 'Number 1', self::TWO => 'Number 2', self::THREE => 'Number 3' ); } //Both following statements will give you stack overflow : /*java.lang.StackOverflowError at java.util.LinkedHashMap$LinkedHashIterator.<init>(LinkedHashMap.java:337) at java.util.LinkedHashMap$EntryIterator.<init>(LinkedHashMap.java:383) at java.util.LinkedHashMap$EntryIterator.<init>(LinkedHashMap.java:383) at java.util.LinkedHashMap.newEntryIterator(LinkedHashMap.java:390) at java.util.HashMap$EntrySet.iterator(HashMap.java:934) at com.caucho.quercus.env.QuercusClass.init(QuercusClass.java:284) at com.caucho.quercus.env.Env.createQuercusClass(Env.java:2793) at com.caucho.quercus.env.Env.createClassImpl(Env.java:2711) at com.caucho.quercus.env.Env.findClass(Env.java:2678) at com.caucho.quercus.env.Env.findClass(Env.java:2653) at com.caucho.quercus.env.Env.getClass(Env.java:2774) at com.caucho.quercus.expr.ClassConstExpr.eval(ClassConstExpr.java:76) at com.caucho.quercus.expr.Expr.evalArg(Expr.java:406) at com.caucho.quercus.expr.ArrayFunExpr.eval(ArrayFunExpr.java:117) at com.caucho.quercus.env.QuercusClass.init(QuercusClass.java:285) at com.caucho.quercus.env.Env.createQuercusClass(Env.java:2793) at com.caucho.quercus.env.Env.createClassImpl(Env.java:2711) at com.caucho.quercus.env.Env.findClass(Env.java:2678) at com.caucho.quercus.env.Env.findClass(Env.java:2653) at com.caucho.quercus.env.Env.getClass(Env.java:2774) at com.caucho.quercus.expr.ClassConstExpr.eval(ClassConstExpr.java:76) ... ... */ echo MyClass::ONE; echo MyClass2::ONE; //The following will give you an error like: // /home/web-app/webroot/crash.php:46: Fatal Error: /home/web-app/webroot/crash.php:46: 'self' is an unknown class. echo MyClass3::ONE; ?> |
||||
Steps To Reproduce: | |||||
Additional Information: | |||||
Relationships | |||||
Attached Files: |
Notes | |||||
|
|||||
|
|
||||
|
|||||
|
|