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
 [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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 22:01:29 2024 UTC