|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #5123 Php 4.0 recognize 'php end tag' inside a string in a commented line...
Submitted: 2000-06-19 14:04 UTC Modified: 2000-08-09 22:06 UTC
From: an at cerca dot com Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.0.0 Release OS: Linux RH 6.1 Kernel 2.2.12-20
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 this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: an at cerca dot com
New email:
PHP Version: OS:


 [2000-06-19 14:04 UTC] an at cerca dot com

/* $s = "this is OK ?>"; */

// $s = "commented text ?>";

# $s = "commented text2 ?>";

echo "hello";


Try to execute this snippet...
Chars "?>" after the text "commented text" are assumed as an end tag of PHP scripting code. 
Rest of the code is displayed as HTML code.
This not occurs if lines are commented with /*...*/

Thank you


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2000-07-27 20:07 UTC]
This is 'by design'.
 [2000-07-27 20:45 UTC]
please read the whole report, not only the short desc ...
 [2000-07-27 21:23 UTC]
Reading the whole report I?d answer "this is by design" too.
It?s a kinf of specification which can be found anywhere
(don?t know where which tells):

"//" commented lines end with either linefeed or closing tag ?>
It?s no bug.
 [2000-07-27 22:41 UTC]
ok, i was in a bit of a hurry, but now i have time
to explain ...

the report is mostly about '?>' in a comment
ending php code blocks and that's ok by design
because the xml parsing part should take precedence
about the php code parsing 

BUT: if it is so by design (and i agree with this)
it should obviously work within /*...*/ comments too

thats the point why i objected against closing this one
 [2000-07-27 22:51 UTC]
that?s hairy,...
it has many advances that you can enclose everything within
/* */ , that double XML/PHP processing perhaps is a case no
specification exists for...
 [2000-08-09 22:06 UTC]
ok, postings in other places have convinced me
that the current behavior should be ok as it is

i will change the documentation accrodingly that
 '//' and '#' comments are terminated by end of line
or end of php block by '?>' , whichever comes first
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun Sep 19 23:03:36 2021 UTC