php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28853 comment fails nested if, resulting in unexpected $end error
Submitted: 2004-06-20 15:51 UTC Modified: 2004-06-23 11:24 UTC
From: t dot noest at noestnet dot nl Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 4.3.7 OS: winnt
Private report: No CVE-ID: None
 [2004-06-20 15:51 UTC] t dot noest at noestnet dot nl
Description:
------------
Sometimes I get a "parse error, unexpected $end at [last line of my script]"
I found when I add an extra "}" to my script (for wich there is not a starting "{", I counted thorough!) it works!

So I cut my script down to the point I had a nested-if left and found that adding a comment results in the error! Delete the comment and the script works as expected!

This plagued me also with 4.3.6 and was the reason for me to upgrade, but that didn't help. Both executables came from the distributed zip's. 



Reproduce code:
---------------
<?PHP
# File to point some strange PHP behaviour....

$a = 10;		 
$b = 100;
$c = true;
$d = false;
if ($d)	{
	$test = true;
}else{
	if ($c)	{
		echo "A<BR>\n";
		$e = $a;
	} else {
		echo "B<BR>\n";
		$e = $b;		# wreck it with this comment!
	}
}
?>
<HTML><BODY>Error Test</BODY></HTML>


Expected result:
----------------
A
Error Test 

Actual result:
--------------
Parse error: parse error, unexpected $end in E:\NoestNet\.....\error.php on line 16


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-06-23 11:24 UTC] t dot noest at noestnet dot nl
Sorry folks, but this one boils down to a corrupt FTP-client. It removed linebreaks so the closing "}" got after the comment.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Oct 17 04:01:28 2024 UTC