php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #6329 Detecting end tag in a comment.
Submitted: 2000-08-24 05:27 UTC Modified: 2001-04-27 18:45 UTC
From: patrick at music-images dot nl Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.0.1pl2 OS: WINDOWS NT 4.0 SP 5
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: patrick at music-images dot nl
New email:
PHP Version: OS:

 

 [2000-08-24 05:27 UTC] patrick at music-images dot nl
I commented this line out with a // but after that ?> is interpreted as an end of script remark. Ofcourse this shouldn't happen, to my opinion in a comment nothing should be parsed.

<?
// onLoad="Javascript:parent.main_view.location='<? echo $base_url . $search_page; ?>';"
?>

the output will be:

';" ?>

But if I run:

<?
/* onLoad="Javascript:parent.main_view.location='<? echo $base_url . $search_page; ?>';" */
?>

there will be no output.

I ran this through PHP in CGI mode. It does not happen to comments within /* */ comment markers.



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-08-24 05:38 UTC] hholzgra@php.net
this is documented behavior for '//' and '#'
style comments, you might consider to use 
'/*...*/' instead in this case

it is done so that for example

<? echo $test; // just testing ?> 

works 
 [2000-08-24 05:39 UTC] stas@php.net
same as #5123
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 01 02:01:36 2025 UTC