Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:42652 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 572 invoked from network); 15 Jan 2009 23:04:44 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Jan 2009 23:04:44 -0000 Authentication-Results: pb1.pair.com header.from=ekneuss@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=ekneuss@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 72.14.220.152 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: ekneuss@gmail.com X-Host-Fingerprint: 72.14.220.152 fg-out-1718.google.com Received: from [72.14.220.152] ([72.14.220.152:20242] helo=fg-out-1718.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C4/B7-59137-701CF694 for ; Thu, 15 Jan 2009 18:04:40 -0500 Received: by fg-out-1718.google.com with SMTP id 16so602956fgg.23 for ; Thu, 15 Jan 2009 15:04:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:sender :to:subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references :x-google-sender-auth; bh=SgcBOPJrqJ1LzWL7xf645Nx0vbclOZ/5sMxsaDewvm8=; b=GkLHnPh18Ssl3HYo2x1ieNMCGFJUwoGHkZtrtM8g5UKzjcLajsP/UxntqeedKXplq7 XlYpU5XexWR9hXb9DS9GkvyPSuh53ixFwvgJ2w6hcUEYk48FdwV9HNYU+aaQSCAB0yfL JE4sLsEdrqpvf8Ep9/WJhFeGW5Kb6OekVEg7k= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references:x-google-sender-auth; b=Jxtrt+uwo0FG1cX+6DZEA+x20umMmI7Rj5VTVb33XYBG9T3mod4O64qePclEyI+y8I oOM9psrx0x3tEM90PTFverBnmlT3OTrVUnKlgcEh+YI5k26BUKT/oZEpgYhFRIHg2LtZ tC+AYwJee18Cf8/CLIW2eH8sCyIhYuFJA8A90= Received: by 10.86.54.3 with SMTP id c3mr1648348fga.75.1232060676889; Thu, 15 Jan 2009 15:04:36 -0800 (PST) Received: by 10.86.35.9 with HTTP; Thu, 15 Jan 2009 15:04:36 -0800 (PST) Message-ID: Date: Fri, 16 Jan 2009 00:04:36 +0100 Sender: ekneuss@gmail.com To: "Robert Lemke" Cc: "PHP Developers Mailing List" In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: X-Google-Sender-Auth: 3745ad43f239398e Subject: Re: [PHP-DEV] Unexpected behavior of $this->$propertyName[...] From: webmaster@colder.ch ("Etienne Kneuss") Hello, On Thu, Jan 15, 2009 at 8:24 PM, Robert Lemke wrote: > Dear internals, > > please consider the following code executed with PHP 5.3alpha3: > > 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