#28118 [Opn->Ana]: 'INT' constant produces parse error
| From: | helly@php.net | Date: | Fri, 23 Apr 2004 08:04:58 +0000 |
| Subject: | #28118 [Opn->Ana]: 'INT' constant produces parse error | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-58627@lists.php.net to get a copy of this message | ||
ID: 28118
Updated by: helly@php.net
Reported By: foospam at wp dot pl
-Status: Open
+Status: Analyzed
-Bug Type: *General Issues
+Bug Type: Compile Failure
Operating System: *
PHP Version: *
New Comment:
ok, changed to analyzed
the parser sees a int conversion "(int)" which has higher priority than
the array initialization.
Previous Comments:
------------------------------------------------------------------------
[2004-04-23 09:57:02] foospam at wp dot pl
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.
------------------------------------------------------------------------
[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