Bug #52823 [Opn->Bgs]: getting constants off variables works, not fields
| From: | cataphract@php.net | Date: | Mon, 13 Sep 2010 02:35:42 +0000 |
| Subject: | Bug #52823 [Opn->Bgs]: getting constants off variables works, not fields | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-154280@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=52823&edit=1
ID: 52823
Updated by: cataphract@php.net
Reported by: klawd+phpbugs at kamundo dot de
Summary: getting constants off variables works, not fields
-Status: Open
+Status: Bogus
Type: Bug
Package: Class/Object related
Operating System: ubuntu
PHP Version: 5.3.3
Block user comment: N
New Comment:
Constants are like static fields, you're supposed to access them
statically.
Even if you were to disagree, this is by design; it's not a bug.
Previous Comments:
------------------------------------------------------------------------
[2010-09-13 04:08:36] klawd+phpbugs at kamundo dot de
Description:
------------
<?php
// this works:
$class = new MyClass();
echo $class::constant."\n"; // As of PHP 5.3.0
// this doesn't but should:
class Foo
{
public function __construct()
{
$this->bar=new MyClass();
echo $this->bar::constant;
}
}
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=52823&edit=1