php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #14042 Comment inside if statement causes parse error
Submitted: 2001-11-13 11:47 UTC Modified: 2001-11-13 12:01 UTC
From: mikedlr at tardis dot ed dot ac dot uk Assigned:
Status: Not a bug Package: Compile Failure
PHP Version: 4.0.6 OS: RedHat Linux 7.2
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
46 - 40 = ?
Subscribe to this entry?

 
 [2001-11-13 11:47 UTC] mikedlr at tardis dot ed dot ac dot uk
If I run the following script

<?php
	if (($rows < 1)) {
		echo "hi ho\n";
//		echo  "<table border=1 width=50%>";
	}
?>

In PHP 4.0.6 (on RedHat 7.2) then I get a parse error like so
-------------------------------------------------------
X-Powered-By: PHP/4.0.6

Content-type: text/html



<br>
<b>Parse error</b>:  parse error in <b>parsetest.php</b> on line <b>10</b><br>
-------------------------------------------------------

Whereas if I run it on PHP 4.0.4 (from RedHat 7.1) I get success like so.

-------------------------------------------------------
X-Powered-By: PHP/4.0.4pl1

Content-type: text/html



hi ho
-------------------------------------------------------

I would expect both to work okay.  The problem goes away if I either delete the comment line or delete the if statement.  

I'll also report this at RedHat.  This is not urgent for me since the work around is obvious (delete the comment line) and unlikely to have any serious effect on the efficiency of my program.  However, I'll check back here to answer any further queries. 

 Best Regards and thanks for all the support and help..
 Michael De La Rue.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-11-13 12:01 UTC] sander@php.net
You're messing with the ASP-tags. 
The line echo "<ta.... contains %> which jumps out of PHP-mode. Then, if EOF has been reached, the brackets haven't been closed, which results in that parse-error.
So, edit your php.ini and disbable asp-tags or use width="50%"> (which is better anyway).
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 30 05:01:30 2024 UTC