php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #51825 Calling a static property with a dynamic class name fails
Submitted: 2010-05-14 17:07 UTC Modified: 2010-05-14 17:11 UTC
From: anis dot berejeb at gmail dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.2.13 OS: Ubuntu 9.10
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: anis dot berejeb at gmail dot com
New email:
PHP Version: OS:

 

 [2010-05-14 17:07 UTC] anis dot berejeb at gmail dot com
Description:
------------
When we call a static property with a dynamic class name, the call fails

Test script:
---------------
<?php 
class foo {
    public static $bar = 'OK';
}
$foo = 'foo';
echo $foo::$bar;

Expected result:
----------------
OK

Actual result:
--------------
syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM, expecting ',' or ';' in 
/home/user/test.php on line 5

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-05-14 17:11 UTC] felipe@php.net
-Status: Open +Status: Bogus
 [2010-05-14 17:11 UTC] felipe@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

This feature was added in 5.3.0.

http://docs.php.net/manual/en/language.oop5.static.php
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 16 11:01:33 2025 UTC