|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #63020 Dynamic functions & methods unification
Submitted: 2012-09-05 20:21 UTC Modified: 2017-10-17 12:27 UTC
From: p dot szymkowski at gmail dot com Assigned:
Status: Suspended Package: Scripting Engine problem
PHP Version: 5.4.6 OS: Any
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 this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: p dot szymkowski at gmail dot com
New email:
PHP Version: OS:


 [2012-09-05 20:21 UTC] p dot szymkowski at gmail dot com
This is more than a feature than a bug.

Usage of '{}' is not unified at all.

Why this syntax:
works, but:

It's really confusing. In "test script" form i am giving you full example of it.

Test script:

function myFunction(){};

// {'myFunction'}(); // doesn't work
$str = 'myFunction';
$str(); // works

class myClass {
  public $bar = 'myClass';
  public $test = 'myClass';
  public function foo() {

// $class = new {'myClass'}(); // doesn't work
$str = "myClass";
$class = new $str(); // works

$class->{'foo'}(); // works

// $class2 = new {$class->test}; // doesn't work
$class2 = new $class->test(); // works

Expected result:
syntax {'myFunction'}(); should work
syntax $class = new {'myClass'}(); should work
syntax $class2 = new {$class->test}; should work

Actual result:
only calling methods and getting properties of class works in that way.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2012-09-06 01:35 UTC]
I'd be surprised if we didn't have bugs/requests for this already, but I can't find them at a glance, so let's leave this open in the right package.

The AST RFC might be of interest here, since it would presumably provide a path towards fixing this:
 [2012-09-06 01:35 UTC]
-Package: Documentation problem +Package: Scripting Engine problem
 [2017-10-17 12:27 UTC]
-Status: Open +Status: Suspended
 [2017-10-17 12:27 UTC]
Thank you for your interest in PHP and for submitting a feature request. Please
be aware that due to the magnitude of change this request requires, it would be
necessary to discuss it on PHP Internals list ( as an
RFC. Please read the guide about creating RFCs here:
<>. If you haven't had experience with writing
RFCs before, it is advised to seek guidance on the Internals list
(<>) and/or solicit help from one of the
experienced developers. 

Please do not consider this comment as a negative view on the merits of your
proposal – every proposal which requires changes of certain magnitude, even the
very successful and widely supported ones, must be done through the RFC process.
This helps make the process predictable, transparent and accessible to all
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Mon Feb 17 06:01:26 2020 UTC