Mantis Bugtracker
  

Viewing Issue Advanced Details Jump to Notes ] View Simple ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0001247 [Quercus] minor always 07-12-06 06:30 03-21-07 10:51
Reporter rikus View Status public  
Assigned To nam
Priority normal Resolution fixed Platform
Status closed   OS
Projection none   OS Version
ETA none Fixed in Version 3.1.1 Product Version
  Product Build
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
Attached Files

- Relationships

- Notes
(0001728)
nam
01-17-07 12:57

related to php/096f
 
(0001782)
nam
03-21-07 10:51

php/09b7
php/39b7
 

- Issue History
Date Modified Username Field Change
07-12-06 06:30 rikus New Issue
11-28-06 08:22 alexcrown Issue Monitored: alexcrown
01-17-07 12:57 nam Note Added: 0001728
01-17-07 12:57 nam Status new => assigned
01-17-07 12:57 nam Assigned To  => nam
03-21-07 10:51 nam Status assigned => closed
03-21-07 10:51 nam Note Added: 0001782
03-21-07 10:51 nam Resolution open => fixed
03-21-07 10:51 nam Fixed in Version  => 3.1.1


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