Bug #53616 [Opn->Bgs]: T_LOGICAL_AND when declaring and() method in class
| From: | felipe@php.net | Date: | Mon, 27 Dec 2010 15:28:48 +0000 |
| Subject: | Bug #53616 [Opn->Bgs]: T_LOGICAL_AND when declaring and() method in class | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-157337@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=53616&edit=1
ID: 53616
Updated by: felipe@php.net
Reported by: hey at lukecarrier dot me
Summary: T_LOGICAL_AND when declaring and() method in class
-Status: Open
+Status: Bogus
Type: Bug
Package: Scripting Engine problem
Operating System: Windows 7 x64
PHP Version: 5.3.4
Block user comment: N
Private report: N
New Comment:
This is expected.
http://docs.php.net/manual/en/tokens.php
Previous Comments:
------------------------------------------------------------------------
[2010-12-27 16:26:45] hey at lukecarrier dot me
Description:
------------
When declaring a method named 'and' within a class, PHP throws a parse
error
because the function name is interpreted as a logical operator
(T_LOGICAL_AND).
This appears to be a bug, as it's clear in this context that the
developer is not
attempting to perform a comparison.
Test script:
---------------
<?php
class LogicalOperatorTest {
public function and() {
echo "successful!";
}
}
?>
Expected result:
----------------
The method LogicalOperatorTest->and() to be declared.
Actual result:
--------------
Parse error: syntax error, unexpected T_LOGICAL_AND, expecting T_STRING
in
C:\pathto\lovely.php on line 5
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=53616&edit=1