Req #50834 [Opn->Bgs]: complex string parsing does not parse static classes
| From: | jani@php.net | Date: | Tue, 14 Dec 2010 15:36:03 +0000 |
| Subject: | Req #50834 [Opn->Bgs]: complex string parsing does not parse static classes | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-156996@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=50834&edit=1
ID: 50834
Updated by: jani@php.net
Reported by: kopelke at gmail dot com
Summary: complex string parsing does not parse static classes
-Status: Open
+Status: Bogus
Type: Feature/Change Request
-Package: Feature/Change Request
+Package: *General Issues
Operating System: Ubuntu 9.10
PHP Version: 5.3.1
Block user comment: N
Private report: N
New Comment:
Also from the same manual page:
Note:
Functions, method calls, static class variables, and class constants
inside {$} work since PHP 5. However, the value accessed will be
interpreted as the name of a variable in the scope in which the string
is defined. Using single curly braces ({}) will not work for accessing
the return values of functions or methods or the values of class
constants or static class variables.
Previous Comments:
------------------------------------------------------------------------
[2010-01-25 15:34:32] kopelke at gmail dot com
Description:
------------
The complex string syntax will not include static classes. I cannot use
them as output.
Quote from doc: In fact, any value in the namespace can be included in a
string with this syntax. Simply write the expression the same way as it
would appear outside the string, and then wrap it in { and }.
I do expect this to be wrong. The documentation states "any value" and
A::$a is a valid value for a string.
Reproduce code:
---------------
class A {
static public $a = 'A';
}
echo "{A::$a}";
Expected result:
----------------
A
Actual result:
--------------
{A::}
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=50834&edit=1