php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #11439 Comments shown when lines separated by CR|CR|LF
Submitted: 2001-06-12 12:30 UTC Modified: 2001-06-12 15:29 UTC
From: danielc at analysisandsolutions dot com Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.0.5 OS: NT 4.0 SP6a
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: danielc at analysisandsolutions dot com
New email:
PHP Version: OS:

 

 [2001-06-12 12:30 UTC] danielc at analysisandsolutions dot com
****  ISSUE:

Comments are visible in the parsed output.

But, this is only happening when the script has it's lines separated by two carriage returns then a line feed (CR|CR|LF) (ASCII Ordinals: 13|13|10).  If the file has lines broken by one carriage return then a line feed, things run correctly.

This report may shed light on bug #11303, entitled "Comment Characters," submitted by another user on 5 June 2001:  http://www.php.net/bugs.php?id=11303

Here's how to recreate the problem...



****  STEP 1:

Point your browser to http://www.analysisandsolutions.com/code/sql/strange.php

This is the source code for that page, if you're interested...


<?php
header("Content-Type: text/plain; charset=ISO-8859-1");
?>
<?php echo "<?php"; ?>

#  Comment at TOP
echo "<html><head><title>Strange Behavior</title></head>\n";
echo "<body><p>Echo at top</p>\n";

<?php echo "?>"; ?>

<p>Some HTML in the middle.</p>

<?php echo "<?php"; ?>

# Comment near bottom.
echo "<p>echo near bottom</p>";

<?php echo "?>"; ?>

</body></html>




****  STEP 2:

Save the resulting output to your web server space.

Don't change the file name, file extension or the type of file.

I was using Netscape to view and save the file.
That may or may not be relevant.

FYI, here is a sample of the output.
Don't use this as the script in the next step.


<?php
#  Comment at TOP
echo "<html><head><title>Strange Behavior</title></head>\n";
echo "<body><p>Echo at top</p>\n";

?>
<p>Some HTML in the middle.</p>

<?php
# Comment near bottom.
echo "<p>echo near bottom</p>";

?>
</body></html>




**** STEP 3:

Now point your web browser to the copy of strange.php
you saved in your web space.

Then point browser to it and it results in...



#  Comment at TOP
# Comment near bottom.
<html><head><title>Strange Behavior</title></head>
<body><p>Echo at top</p>


<p>Some HTML in the middle.</p>



<p>echo near bottom</p>

</body></html>




****  NOTE:

All of the comments are pushed to the beginning of the
program and then displayed.  Ouch!

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-06-12 15:29 UTC] jmoore@php.net
fixed in latest cvs. Thanks for your report.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue May 06 00:01:29 2025 UTC