php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #49744 Multi-line comment at EOF causes no output
Submitted: 2009-10-02 04:19 UTC Modified: 2009-10-10 01:00 UTC
From: michael dot cordover+php at gmail dot com Assigned:
Status: No Feedback Package: Reproducible crash
PHP Version: 5.2.11 OS: Linux
Private report: No CVE-ID: None
 [2009-10-02 04:19 UTC] michael dot cordover+php at gmail dot com
Description:
------------
An unterminated multi-line comment (i.e. /* without */) that runs to the end of the file causes the parser to stop upon encountering certain functions (phpinfo() and trigger_error() verified; others not checked).

This behaviour did not occur in 5.2.5 but does occur in 5.2.10

Environment:
PHP Version 5.2.10
FreeBSD [host-removed] 6.2-RELEASE-p12 FreeBSD 6.2-RELEASE-p12 #3: Tue Apr 14 20:41:44 UTC 2009 root@[host-removed]:/usr/obj/usr/src/sys/SERVER i386
Build Date 	Jul 2 2009 15:29:12
Configure Command 	'./configure'
Server API 	Apache
PHP API 	20041225
PHP Extension 	20060613
Zend Extension 	220060519
Apache Version 	Apache
Apache Release 	10339100
Apache API Version 	19990320

Reproduce code:
---------------
<?php

echo 'Test';

if (false) {
  phpinfo();
}

/*

?>

Expected result:
----------------
HTTP 200 OK HEAD
Associated default PHP headers (Date, Connection, Proxy-Connection, Content-Type, Server, X-Powered-By)
Body content 'Test' (content-length 4)

This result is obtained by removing the block comment opener (/*) or by closing the block comment, even if closed AFTER ?>

Actual result:
--------------
HTTP 500 Internal Server Error in HEAD
Default PHP headers (Date, Connection, Proxy-Connection, Date, Content-Type, Server, X-Powered-By)
No output (content-length 0)
No error logged by Apache
Apache does not load ErrorDocument 500

I am unfortunately not in a position to generate a backtrace (shared hosting).

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-10-02 04:23 UTC] michael dot cordover+php at gmail dot com
It should be noted that the following code does not create this error.

<?php

echo 'Test';

if (false) {
  
}

/*

?> */
 [2009-10-02 11:33 UTC] sjoerd@php.net
Please enable error_reporting and display_errors. Are you seeing an error like this?

Warning: Unterminated comment starting line 9 in /data/home/sjoerd/public_html/svnreps/test/a.php on line 9
Fatal error: fatal flex scanner internal error--end of buffer missed in /data/home/sjoerd/public_html/svnreps/test/a.php on line 9
 [2009-10-10 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-2025 The PHP Group
All rights reserved.
Last updated: Mon Jul 14 08:01:30 2025 UTC