php.net |  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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
46 - 21 = ?
Subscribe to this entry?

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

/* $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
Antonello

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-07-27 20:07 UTC] jalal@php.net
This is 'by design'.
 [2000-07-27 20:45 UTC] hholzgra@php.net
please read the whole report, not only the short desc ...
 [2000-07-27 21:23 UTC] waldschrott@php.net
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] hholzgra@php.net
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] waldschrott@php.net
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] hholzgra@php.net
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-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 20:01:28 2024 UTC