#40112 [Opn->Bgs]: Cannot create class method named include/require
ID: 40112
Updated by: iliaa@php.net
Reported By: jjohnston at mailwise dot com
-Status: Open
+Status: Bogus
Bug Type: Class/Object related
Operating System: SuSE Linux
PHP Version: 4.4.4
New Comment:
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
Because require is a reserved keyword.
Previous Comments:
------------------------------------------------------------------------
[2007-01-12 17:12:57] jjohnston at mailwise dot com
Description:
------------
The php parsing engine will not allow class methods that are named
include/require/include_once/require_once. While I understand why you
cannot create functions with these names, $object->include() or
CLASS::include() in no way conflicts with include().
Is there a reason for this or is it an oversight in the parser?
Reproduce code:
---------------
<?php
class MW
{
function require_once($file)
{
}
}
?>
Expected result:
----------------
No parse error =)
Actual result:
--------------
Parse error: syntax error, unexpected T_REQUIRE_ONCE, expecting
T_STRING in .....
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=40112&edit=1
Thread (2 messages)