The code below takes Zend Framework out of the loop, and tests the problem 
directly.

Please try the code. Does anyone have the same output as me with 
myRuntimeProperty missing in the var_dump? If you do, I think 
Zend_Form_Element::getAttribs() will not work with your PHP version, and 
maybe I should raise it on bugs.php.net. Any comments appreciated.

Regards,
Mark

<?php

class Test
{
    public $myDeclaredProperty = 1;

    public function __construct()
    {
        $this->myRuntimeProperty = 2;
    }

    public function getPublicProperties()
    {
        $r = new ReflectionObject($this);
        $properties = $r->getProperties();
        $publicProperties = array();
        foreach ($properties as $property) {
            if ($property->isPublic()) {
                $publicProperties[$property->getName()] = 
$property->getValue($this);
            }
        }
        return $publicProperties;
    }
}
echo 'Running ' . phpversion() . "\n";
$obj = new Test();
echo "Dumping object:\n";
var_dump($obj);
echo "Dumping public properties according to Reflection object\n";
var_dump($obj->getPublicProperties());


My output:

Running 5.2.0-8+etch9
Dumping object:
object(Test)#1 (2) {
  ["myDeclaredProperty"]=>
  int(1)
  ["myRuntimeProperty"]=>
  int(2)
}
Dumping public properties according to Reflection object
array(1) {
  ["myDeclaredProperty"]=>
  int(1)
}



On Wednesday 30 January 2008 14:06, Matthew Weier O'Phinney wrote:
> -- Mark Maynereid <[EMAIL PROTECTED]> wrote
>
> (on Wednesday, 30 January 2008, 01:22 PM +0000):
> > I can't seem to make "title" attributes render.
> >
> > I think it might be a bug in PHP's Reflection class so I've had a go at a
> > patch which seems to correct it, but I wonder if anyone else can
> > reproduce this: http://framework.zend.com/issues/browse/ZF-2526
>
> If anybody can verify that Mark's patch works, please let me know, and
> I'll apply it.

Reply via email to