#28118 [Bgs->Opn]: 'INT' constant produces parse error
| From: | foospam at wp dot pl | Date: | Fri, 23 Apr 2004 07:57:03 +0000 |
| Subject: | #28118 [Bgs->Opn]: 'INT' constant produces parse error | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-58626@lists.php.net to get a copy of this message | ||
ID: 28118
User updated by: foospam at wp dot pl
Reported By: foospam at wp dot pl
-Status: Bogus
+Status: Open
Bug Type: *General Issues
Operating System: *
PHP Version: *
New Comment:
Hey, that IS bug, because I want to use NOT RESERVED WORD, and parser
causes an error!
I have checked everything related with constants in PHP Manual
(language -> constants, list of predefined constants, list of parser
tokens, list of reserved words, EVEN LIST OF FUNCTIONS AND THEIR
ALIASES), and there is no "INT" constant or anything related with it
described!
BTW, "INT" constant name SHOULD WORK EVEN, if there is already
registered function with that name - I've checked: constant "is_int"
does work.
I know: there is a cast: `(int)', but:
array(int)
is different from
(int) $foo
parser should recognize, that my "INT" is user-defined constant,
because I want to use it as the array element.
Previous Comments:
------------------------------------------------------------------------
[2004-04-23 09:31:57] helly@php.net
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
int is a reserverd keyword (in the docs you\'ll find a list of all
reserved keywords)
------------------------------------------------------------------------
[2004-04-23 09:07:00] foospam at wp dot pl
Description:
------------
seems, that "INT" string is some keyword for parser.
Reproduce code:
---------------
define('INT', 2);
$types = array(1 * INT);
foreach($types as $type) {
echo $type . "<br />\n";
}
echo "<hr />\n";
$types = array(INT);
foreach($types as $type) {
echo $type . "<br />\n";
}
Expected result:
----------------
2<br />
<hr />
2<br />
Actual result:
--------------
Parse error: parse error, expecting `'('' in X on line 7.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=28118&edit=1