php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #35184 undefined function parse-error in if-clause
Submitted: 2005-11-10 17:22 UTC Modified: 2005-11-18 01:00 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: mg at memedia dot de Assigned:
Status: No Feedback Package: Scripting Engine problem
PHP Version: 5.0.5 OS: Various
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: mg at memedia dot de
New email:
PHP Version: OS:

 

 [2005-11-10 17:22 UTC] mg at memedia dot de
Description:
------------
This problem only occurs sometimes. I only had it for 5-8 times, but it really drives me crazy for now. I can't explain myself to be such a bad programmer, so it must be a bug. 


It occurs sometimes in if clauses like:

if (isset($a) || isset($b)) {
	// do something
}

..and PHP returns 
"Fatal error: Call to undefined function  () in /index.php on line XX"


If the if-clause was "((isset($a)) || (isset($b)))" it helped to remove the additional parenthesis, and do "(isset($a) || isset($b))2 instead.
Also the error was eliminated in some cases by adding another side to the expressions, like "((isset($a)==true) || (isset($b)==false))".

But for now I'm really fed up with this:

$a=isset($_GET['action']);
$b=$a && (strpos($_GET['action'], 'admin')===false);

if (($a) || ($b)) {
	echo "if it works or not doesn't matter; the question is if it can be parsed";
}

I tried everything but I can't get that expression to work. In antoher case i really wrote TWO if-clauses with only one statement that called one and the same function. Working an above code also revaled that $b becomes unexptected, when writing:

if ($a || $b) {
	echo "if it works or not doesn't matter; the question is if it can be parsed";
}
Parse error: parse error, unexpected T_VARIABLE in /index.php on line 353


Anyway, that error occurs only in some bunch of code and cannot really be reproduced with a single file containing above code-snippets.

I appreciate appropiate workarounds for that problem ;)


PHP Version doesn't matter. I had the problem with PHP 4.x and still have it with 5.04 and 5.1RC3.



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-11-10 17:31 UTC] tony2001@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc.

If possible, make the script source available online and provide
an URL to it here. Try to avoid embedding huge scripts into the report.


 [2005-11-18 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 17 03:01:32 2024 UTC