Edit report at http://bugs.php.net/bug.php?id=53298&edit=1
ID: 53298
User updated by: jost dot boekemeier at googlemail dot com
Reported by: jost dot boekemeier at googlemail dot com
Summary: // $msg_text = '?>...';
Status: Bogus
Type: Bug
Package: *General Issues
Operating System: any
PHP Version: 5.2.14
Block user comment: N
Private report: N
New Comment:
> @jost dot boekemeier: I'll preface this comment with "I'm just a
regular
PHP user, not a PHP org member".
Then please do not comment other one`s bug reports.
This bug report is about a change in the php parser. It was working
perfectly
until someone changed it to not recognize ?> within strings. The bug is
that
he did not make the same change for strings in single line comments.
There
is nothing to discuss about. The person who made the change clearly
wrote a
bug.
Your comments about multi line comments and IDE are offtopic here.
Please
open a new support request for that. Thank you.
Previous Comments:
------------------------------------------------------------------------
[2010-11-18 03:41:06] bastard dot internets at gmail dot com
@jost dot boekemeier: I'll preface this comment with "I'm just a
regular PHP user, not a PHP org member".
Changing the // behavior would break the usage in in-line php, shown on
the 2nd example on the doc page. Something like the following would no
longer work...
<p>This is a paragraph about <?php echo $subject; // important comment
here ?>.</p>
Looks ugly here, but with any IDE, the color-coding makes it all pretty
intelligible. The doc page is pretty clear about this comment usage.
The workaround to comment out any entire block containing any "?>"
symbol would be to use the /* */ symbols instead. Of course this goes
against convenience and habit, and as other users have noted, this
breaks lines with */ appearing anywhere (ie. regex strings, nested
comments, etc). But fixing -those- problems would break things
elsewhere, like in this example of sourcecode documentation...
function do_something(/* integer */ $some_int, /* string */ $some_str)
{/* do something */}
This report seems more like a feature request. I'd vote for something
like skipping the in-comment PHP mode escape if the // symbol doesn't
appear on a same line as any opening PHP tag. Though I'm sure devs can
think of a better solution.
------------------------------------------------------------------------
[2010-11-14 14:38:58] jost dot boekemeier at googlemail dot com
[email protected], thank you very much for taking the time to comment my
request, even though you haven't understood it.
1. commenting out a valid variable definition should not cause the PHP
parser to *suddenly* parse the definition!
2. this is completely unexpected, even after reading the documentation
Please either fix this bug. Change the PHP parser to handle
$var = "val<?ue";
and
// $var = "val<?ue";
equally: The parser should either stop at the <? or not. For example if
you force the programmer to always write "val<"."?ue", the problem
vanishes.
The current behaviour means that you can expose the contents of an
existing PHP file (including database passwords) by commenting out a
simple variable definition. -- Line-comments can be problematic, but it
shouldn't have such a drastic effect that the script returns
unevaluated.
Or please clearly document this bug, so that programmers do not use
//-style comments to comment-out variable definitions.
------------------------------------------------------------------------
[2010-11-12 21:43:23] [email protected]
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
------------------------------------------------------------------------
[2010-11-12 20:39:36] bastard dot internets at gmail dot com
"?>" is meant to break out of PHP when encountered in a single-line
comment (see
http://www.php.net/manual/en/language.basic-syntax.comments.php).
------------------------------------------------------------------------
[2010-11-12 12:19:20] jost dot boekemeier at googlemail dot com
corrected mail address
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/bug.php?id=53298
--
Edit this bug report at http://bugs.php.net/bug.php?id=53298&edit=1