Mantis - Quercus
Viewing Issue Advanced Details
3038 minor always 11-03-08 10:10 06-23-12 00:37
ferg  
nam  
normal  
closed 4.0.10  
fixed  
none    
none  
0003038: Zend framework and static instances
(rep by Daniel Lopez)


I think I found something related to the issue, as Quercus seems to
have some problems with PHP static members.
I created the following test:
***************************************
<?
class Test
{
    protected static $_instance = null;
    protected $_variable = null;
    /**
     * Singleton instance
     */
    public static function getInstance()
    {
        $reflection = new ReflectionClass('Test');
        foreach ($reflection->getProperties() as $property) {
            $name = $property->getName();
            echo "Member: ".$name."
"
        }
        if (null === self::$_instance) {
            self::$_instance = new self();
        }

        return self::$_instance;
    }
}
    $testInstance = Test::getInstance();
?>
***************************************
If I execute the test under regular PHP, the result is:
---
Member: _instance
Member: _variable
---
If I execute it under Quercus, I just get
---
Member: _variable
---
The strange thing is that accessing the $_instance static memeber in
this little test works, but a very similar code is inside
Zend_Controller_Front class in the Zend framework and there it
complains that $_instance has not been declared, even though you can
see the declaration a couple of lines above.

So, even though is seems it is not the full issue, it seems to be
strongly related. In any case, one would say that reflection in
Quercus is broken, right?

Tested using Resin 3.1.7a and resin 3.2.1. Trying to use Zend in 3.2.1
I don't get the error I was showing above, but a blank page and no
error message anywhere.

 reflection.qa [^] (721 bytes) 09-29-10 08:20

Notes
(0003817)
nam   
02-09-09 07:01   
php/520b

Issue does not exist in 4.0.

Reflection has been cleaned up and fully implemented for 4.0.
(0004767)
domdorn   
09-29-10 07:03   
Issue not fixed in current 4.0.10!

Test still reports just
<code>
Member: _instance
</code>

instead of
<code>
Member: _instance
Member: _variable
</code>
(0004768)
domdorn   
09-29-10 07:04   
reopened issue.
(0005940)
nam   
06-23-12 00:37   
php/520b

Fixed for 4.0.29.