php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27086 Comments dont work if you have ?> in them
Submitted: 2004-01-29 08:18 UTC Modified: 2004-01-29 10:53 UTC
From: jaba at inbox dot lv Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.0.0b3 (beta3) OS: any?
Private report: No CVE-ID: None
 [2004-01-29 08:18 UTC] jaba at inbox dot lv
Description:
------------
Comment line starters # and // dont work properly. I thought everything that follows these signs is considered a comment. Now in PHP5 (have no place to test on PHP4 now) i find out that if i have the PHP tag ?> in the commented line, the parser ends parsing PHP right there! So if you have smth like this in your code, then the rest of php code is sent as output !!!

Reproduce code:
---------------
<?php
echo 'hello world!';
// echo '?>';
$password='secretpassword';
?>

Expected result:
----------------
hello world!

Actual result:
--------------
hello world!';
$password='secretpassword';
?>

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-01-29 08:22 UTC] edink@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

.
 [2004-01-29 10:47 UTC] jaba at inbox dot lv
If this is not a bug, i must be an elephant. Just check this out, sir:

At first, take this code:
<?php
	echo '?>';
	echo '?>';
	echo '?>';
?>

And then take this one:
<?php
	echo '?>';
	//echo '?>';
	echo '?>';
?>

This is bug if i cant comment a line that outputs a string that has "some special characters".
 [2004-01-29 10:53 UTC] mgf@php.net
Dear elephant,

This behaviour of ?> in a comment is documented in the PHP manual, and has been as long is I've been using it.

Definitely *not* a bug.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Oct 18 00:01:28 2024 UTC