Date: 12/17/00
- Next message: andi <email protected>: "[PHP-DEV] PHP 4.0 Bug #6957 Updated: Zend strlen function gets re-defined"
- Previous message: Andi Gutmans: "Re: [PHP-DEV] Re: [PHP-QA] convention about function naming II"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
ID: 8247
Updated by: andi
Reported By: boian <email protected>
Old-Status: Analyzed
Status: Closed
Bug Type: Scripting Engine problem
Assigned To:
Comments:
This is fixed in the current CVS (the ??> issue)
Note that // only comments until newline or ?>.
It won't comment ?>. It has been like this since the one line comments were introduced.
Thanks for the bug report.
Previous Comments:
---------------------------------------------------------------------------
[2000-12-14 04:10:01] stas <email protected>
In fact, only ??> case is problematic now. That's because
([#]|"//")([^nr?]|"?"[^>nr])*("?n"|"?rn")? expression
eats any character that is not > after ?. Inlcuding second
?. That should be fixed.
---------------------------------------------------------------------------
[2000-12-14 00:29:16] boian <email protected>
case one:
<?
// case 1 ??>
?>
case two:
<?
// simple case ???>
?>
case three:
<?
// stoopid_foo("?>");
?>
to resolve the problem(s) i have patched Zend/zend-scanner.l
--- /usr/src/php-4.0.3pl1/Zend/zend-scanner.l Thu Oct 5 20:58:46 2000
+++ zend-scanner.l Thu Dec 14 07:16:13 2000
@@ -29,6 +29,10 @@
%x ST_LOOKING_FOR_PROPERTY
%x ST_LOOKING_FOR_VARNAME
%x ST_COMMENT
+%x ST_ONELINECOMMENT
+%x ST_ONELINECOMMENT_SQ
+%x ST_ONELINECOMMENT_DQ
+%x ST_ONELINECOMMENT_BQ
%option stack
%{
@@ -1154,8 +1158,68 @@
}
-<ST_IN_SCRIPTING>([#]|"//")([^nr?]|"?"[^>nr])*("?n"|"?rn")? { /* eat one line comments */
+<ST_IN_SCRIPTING>([#]|"//")([^nr?'"`]|("?"+[^?>nr'"`]))* { /* begin eating one line comments */
+ BEGIN(ST_ONELINECOMMENT);
+ yymore();
+}
+
+<ST_ONELINECOMMENT>([']|("?"+['])) { /* eat single quoted comments */
+ BEGIN(ST_ONELINECOMMENT_SQ);
+ yymore();
+}
+
+<ST_ONELINECOMMENT>(["]|("?"+["])) { /* eat double quoted comments */
+ BEGIN(ST_ONELINECOMMENT_DQ);
+ yymore();
+}
+
+<ST_ONELINECOMMENT>([`]|("?"+[`])) { /* eat back quoted comments */
+ BEGIN(ST_ONELINECOMMENT_BQ);
+ yymore();
+}
+
+<ST_ONELINECOMMENT>("n"|"rn"|("?"+"n")|("?"+"rn"))? { /* unexpected end of line or end of comment */
+ HANDLE_NEWLINE(yytext[yyleng-1]);
+ BEGIN(ST_IN_SCRIPTING);
+ return T_COMMENT;
+}
+
+<ST_ONELINECOMMENT>"?"+">" {
+ yyless(yyleng-2);
+ BEGIN(ST_IN_SCRIPTING);
+ return T_COMMENT;
+}
+
+<ST_ONELINECOMMENT_SQ>([^'nr\]|[\][^nr])* { /* eat quoted content */
+ yymore();
+}
+
+<ST_ONELINECOMMENT_DQ>([^"nr\]|[\][^nr])* {
+ yymore();
+}
+
+<ST_ONELINECOMMENT_BQ>([^`nr\]|[\][^nr])* {
+ yymore();
+}
+
+<ST_ONELINECOMMENT_SQ>[']([^nr?'"`]|"?"+[^?>nr"'`])* { /* end of quoted content */
+ BEGIN(ST_ONELINECOMMENT);
+ yymore();
+}
+
+<ST_ONELINECOMMENT_DQ>["]([^nr?'"`]|"?"+[^?>nr"'`])* {
+ BEGIN(ST_ONELINECOMMENT);
+ yymore();
+}
+
+<ST_ONELINECOMMENT_BQ>[`]([^nr?'"`]|("?"+[^?>nr"'`]))* {
+ BEGIN(ST_ONELINECOMMENT);
+ yymore();
+}
+
+<ST_ONELINECOMMENT_SQ,ST_ONELINECOMMENT_DQ,ST_ONELINECOMMENT_BQ>"n"|"rn" { /* unexpected end of line */
HANDLE_NEWLINE(yytext[yyleng-1]);
+ BEGIN(ST_IN_SCRIPTING);
return T_COMMENT;
}
---------------------------------------------------------------------------
Full Bug description available at: http://bugs.php.net/?id=8247
-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: andi <email protected>: "[PHP-DEV] PHP 4.0 Bug #6957 Updated: Zend strlen function gets re-defined"
- Previous message: Andi Gutmans: "Re: [PHP-DEV] Re: [PHP-QA] convention about function naming II"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

