|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2004-05-01 16:39 UTC] 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
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Dec 03 21:00:01 2025 UTC |
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]----