Req #65399 [Opn->Wfx]: Parse error when trying to access class constant from another class property
Edit report at https://bugs.php.net/bug.php?id=65399&edit=1
ID: 65399
Updated by: ab@php.net
Reported by: filippovdaniil at gmail dot com
Summary: Parse error when trying to access class constant
from another class property
-Status: Open
+Status: Wont fix
Type: Feature/Change Request
Package: Scripting Engine problem
Operating System: Debian Wheezy 7.0
PHP Version: 5.5.1
Block user comment: N
Private report: N
New Comment:
same reason as bug #65218
Previous Comments:
------------------------------------------------------------------------
[2013-08-06 07:52:18] filippovdaniil at gmail dot com
Description:
------------
Workaround:
$obj = $b->obj;
echo $obj::foo;
Test script:
---------------
<?php
class a{
const foo = "test";
}
class b{
public $obj = null;
public function __construct(){
$this->obj = new a;
}
}
$b = new b;
echo $b->obj::foo; // Parse error!
Expected result:
----------------
test
Actual result:
--------------
Parse error: syntax error, unexpected '::' (T_PAAMAYIM_NEKUDOTAYIM)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=65399&edit=1
Thread (2 messages)