Hello,

On Thu, Jan 15, 2009 at 8:24 PM, Robert Lemke <rob...@typo3.org> wrote:
> Dear internals,
>
> please consider the following code executed with PHP 5.3alpha3:
>
> <?php
> class Foo {
>        protected $foo = array('bar' => 'baz');
>
>        public function test() {
>                $propertyName = 'foo';
>                var_dump(isset($this->foo['bar']));
>                var_dump(isset($this->$propertyName['bar']));
>        }
> }
>
> $object = new Foo;
> $object->test();
> ?>
>
> Expected output:
>
> array
>  'foo' =>
>    array
>      'bar' => string 'quux' (length=4)
>
> Actual output:
>
> array
>  'foo' =>
>    array
>      'bar' => string 'baz' (length=3)
>  'f' => string 'quux' (length=4)
>
> Is this a bug or missing feature?

It's a simple matter of precedence.
You want $this->{$propertyName}['bar']; here

Regards

>
> Cheers,
> robert
>
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
>



-- 
Etienne Kneuss
http://www.colder.ch

Men never do evil so completely and cheerfully as
when they do it from a religious conviction.
-- Pascal

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to