php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #42623 Dynamically accessing array properties
Submitted: 2007-09-11 12:40 UTC Modified: 2007-09-11 15:55 UTC
From: adrian dot gheorghe at gmail dot com Assigned:
Status: Not a bug Package: Variables related
PHP Version: 5.2.4 OS: Windows
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: adrian dot gheorghe at gmail dot com
New email:
PHP Version: OS:

 

 [2007-09-11 12:40 UTC] adrian dot gheorghe at gmail dot com
Description:
------------
This is a continuation of #42622 - I'm sorry I had to open a new bug report, but the old one was marked as bogus and could not comment on it.

Reproduce code:
---------------
class Foo
{
  function example( $name )
  {
    $bar = $this->getBar();
    echo $bar->$name;
  }
}

Expected result:
----------------
Should work for both example('abc') and example('a["b"]')

Actual result:
--------------
Doesn't work for example('a["b"]')

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-09-11 15:55 UTC] iliaa@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

When you pass 'a["b"]', the entire expression is considered to be a 
string and as such is interpreted as a property name.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 30 01:00:02 2025 UTC