#42313 [Csd]: Example 19.13 shows invalid syntax
| From: | phpbugs at colin dot guthr dot ie | Date: | Wed, 15 Aug 2007 23:03:23 +0000 |
| Subject: | #42313 [Csd]: Example 19.13 shows invalid syntax | ||
| References: | 1 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969377365@lists.php.net to get a copy of this message | ||
ID: 42313
User updated by: phpbugs at colin dot guthr dot ie
Reported By: phpbugs at colin dot guthr dot ie
Status: Closed
Bug Type: Documentation problem
Operating System: Linux
PHP Version: Irrelevant
Assigned To: colder
New Comment:
Haha! Spooky timing :)
Thanks for the very fast response.
FWIW, I now see the reference to 5.2.4 but I didn't see it first time
round. It may be worth pointing this out clearly next to the example
also.
Thanks again.
(PS I don't expect any further response - just adding my comments for
clarity)
Previous Comments:
------------------------------------------------------------------------
[2007-08-15 22:57:18] bjori@php.net
This syntax was added in PHP5.2.4RC1 but reverted in PHP5.2.4RC2 and
won't be available until PHP5.3.0 (not 5.2.4 as the comment there
says).
This was fixed in CVS earlier today
------------------------------------------------------------------------
[2007-08-15 22:48:46] phpbugs at colin dot guthr dot ie
Description:
------------
On the following manual page:
http://www.php.net/manual/en/language.oop5.paamayim-nekudotayim.php
Example 19.13 gives the code listed below. This causes a parse error.
Reproduce code:
---------------
<?php
class OtherClass extends MyClass
{
public static $my_static = 'static var';
public static function doubleColon() {
echo parent::CONST_VALUE . "\n";
echo self::$my_static . "\n";
}
}
$classname = 'OtherClass';
echo $classname::doubleColon();
OtherClass::doubleColon();
?>
Expected result:
----------------
I would expect $classname::doubleColon() call to succeed according to
the docs.
The alternative [call_user_func(array($classname, 'doubleColon'))] is
not quite as neat in code.
Judging by comments on the above linked page this has not worked since
2005!
Actual result:
--------------
PHP Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM,
expecting ',' or ';' in file.php on line 13
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=42313&edit=1