php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45310 Unexpected $end in script that runs normally in 5.2.6
Submitted: 2008-06-19 07:50 UTC Modified: 2008-06-19 07:55 UTC
From: anthony dot levensalor at gmail dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 6CVS-2008-06-19 (snap) OS: Windows Vista Business
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: anthony dot levensalor at gmail dot com
New email:
PHP Version: OS:

 

 [2008-06-19 07:50 UTC] anthony dot levensalor at gmail dot com
Description:
------------
Steps to Reproduce: 
1. Browse to script on localhost in Apache 2.2 using [PHP 6.0.0-dev (built: Jun 19 2008 02:05:40)]

2. open command window
3. Using PHP 5.2.6 (cli) (built: May  2 2008 18:02:07) "php -l template.php"
4. Note no syntax errors found
5. Using [PHP 6.0.0-dev (cli) (built: Jun 19 2008 02:05:40)] "php -l template.php"
6. Note 'Unexpected $end at line 41...' (1 more than actual line count of 40 lines)

Expected result: No parse error in valid syntax.


Reproduce code:
---------------
<?php  
	@session_start();	
	require_once("../inc/ddibase.inc.php");
?>
<?php require_once("header.php"); ?>
<div id="page">
	<?php sessionStatus(); ?>
	<?php if (function_exists("submenu")) { ?>
	<div id="submenu">		
		<?php submenu(); ?>
	</div>
	<? } ?>
	<div id="content">
		<div style="margin-bottom: 20px;">
		<?php if (function_exists("main")) { main(); } ?>
		</div>
		<div>&nbsp;</div>		
	</div>
	<!-- end content -->
	<?php if (function_exists("sidebar")) { ?>
	<div id="sidebar">
		<?php sidebar(); ?>
	</div>
	<?php } ?>
	<!-- end sidebar -->
	<div style="clear: both;">&nbsp;</div>
</div>
<!-- end page -->
<?php require_once("footer.php"); ?>
</body>
</html>
<?php
	/*
		The following is the layout for the content to be written by the main function
		<div style="margin-bottom: 20px;">
			<h1 class="title">Page Title</h1>
			<p>Page Content</p>
		</div>
	*/  
?>

Expected result:
----------------
Expected same result from 5.2.6 and 6.0.0-Dev parser given valid PHP syntax.

Actual result:
--------------
/* Command line interop follows */

# php -l template.php
No syntax errors detected in template.php

# php -v
PHP 5.2.6 (cli) (built: May  2 2008 18:02:07)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies

# c:\php6\php.exe -l template.php
PHP Parse error:  syntax error, unexpected $end in template.php on line 40

Parse error: syntax error, unexpected $end in template.php on line 40
Errors parsing template.php

# c:\php6\php -v
PHP 6.0.0-dev (cli) (built: Jun 19 2008 02:05:40)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v3.0.0-dev, Copyright (c) 1998-2008 Zend Technologies


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-06-19 07:55 UTC] anthony dot levensalor at gmail dot com
Please disregard this submission, turns out I'm an idiot. I left a short open tag in the code by mistake, and my 5.2.6 is configured to allow it. Using the default short_open_tag = Off, the code was just wrong, not the engine.

Sorry to have wasted your time.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Nov 22 01:00:02 2025 UTC