#28243 [Com]: strange parse error

From: Date: Fri, 16 Jul 2004 08:26:41 +0000
Subject: #28243 [Com]: strange parse error
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-62457@lists.php.net to get a copy of this message
ID: 28243 Comment by: s dot pfalz at teles dot de Reported By: esflightsim at hotmail dot com Status: Bogus Bug Type: Scripting Engine problem Operating System: Linux PHP Version: 5.0.0RC2 New Comment: Well you are right that this is wrong usage of isset(), but looking at the behavour I would say that this is wrong, PHP 4 reports the correct error like this: PHP Parse error: parse error, expecting T_VARIABLE' or '$'' in /home/siegel/php_tests.php on line 6 But with PHP 5.0.0 you will get now: Parse error: parse error, unexpected ')', expecting T_PAAMAYIM_NEKUDOTAYIM in /html/php_tests.php on line 6 which is in turn a complete wrong error message! here's the code that produces this (I know that it is wrong to isset() a constant, but PHP shouldn't answer with such a error message IMO). Even when one makes errors the interpreter should give accurate responses. ---[SNIP]--- define(SOME_VALUE ,2); if(!isset(SOME_VALUE)) echo("Not found"); else echo("found"); ---[SNAP]---- Previous Comments: ------------------------------------------------------------------------ [2004-05-01 16:42:00] gschlossnagle@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 From the manual: isset -- Determine whether a variable is set ------------------------------------------------------------------------ [2004-05-01 16:39:35] esflightsim at hotmail dot com Description: ------------ When I use isset() with a constant, it returns a strange parse error Reproduce code: --------------- <?php // No direct access if(isset(MAIN_PAGE)) { Expected result: ---------------- Parse error: parse error, unexpected 'T_CONSTANT' expecting T_VAR in /home/eirik/public_html/fspage/include1.php on line 3 Actual result: -------------- Parse error: parse error, unexpected ')', expecting T_PAAMAYIM_NEKUDOTAYIM in /home/eirik/public_html/fspage/include1.php on line 3 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=28243&edit=1

« previous php.bugs (#62457) next »