ID: 3077
Updated by: sniper
Reported By: [EMAIL PROTECTED]
Old-Status: Feedback
Status: Closed
Bug Type: Scripting Engine problem
Assigned To:
Comments:
No feedback. And should be fixed.
--Jani
Previous Comments:
---------------------------------------------------------------------------
[2001-01-06 00:55:43] [EMAIL PROTECTED]
Could you please check if this exists in 4.0.4 or latest CVS? ASP-style tags and
single line comments work for me(TM).
---------------------------------------------------------------------------
[2000-10-18 19:16:49] [EMAIL PROTECTED]
This is partly fixed in 4.0.3pl1. ASP tags are recognized, but they still don't work
with single-line comments. You still need to apply the patch I submitted for the "eat
one line comments" line of the lexer. All it does is replace "?" with "[?%]" in the
regexp so that it works for <% as well as <?. Of course, if you have asp_tags off,
you might not want that to happen... I'm not sure what's best in that case.
Here is a valid PHP script that gets a parse error from 4.0.3pl1.
<html><head><title>comments test</title></head>
<body>
<hr>
<?php echo("Hash comments workn"); $variable="blah"; # never mind this stuff ?>
<?= $variable; # This is a shortcut for "<?echo .." ?>
<p>
<% echo ("You may optionally use ASP-style tags"); $variable = "boo"; %>
<% echo (" (if they work)"); # this should be ignored also %>
<%= $variable; # This is a shortcut for "<%echo .." %>
<hr>
<? phpinfo() ?>
</body>
</html>
---------------------------------------------------------------------------
[2000-06-06 21:33:07] [EMAIL PROTECTED]
This should be fixed in the latest CVS.
Please grab it or in about 24 hours get the latest snapshot from snaps.php.net
---------------------------------------------------------------------------
[1999-12-31 21:30:01] [EMAIL PROTECTED]
Ok, I have a workaround, and a related bug fix.
I think the first time I missed an occurrence of asp_tags in zend-scanner.l.
This time I did a global search and replace, and ASP tags started working. phpinfo()
still shows that I set the asp_tags flag On, so I don't understand why this made a
difference.
Once I got that working, I found a clearer bug: the scanner doesn't support one-line
comments in ASP tags.
Even though they're shown in the ASP tags example at
http://www.php.net/manual/language.basic-syntax.php3
Here are the changes I made to get it working:
--- zend-scanner.l 1999/12/30 22:31:18 1.1.1.2
+++ zend-scanner.l 2000/01/01 02:24:16
@@ -1031,7 +1031,7 @@
<INITIAL>"<%="|"<?=" {
- if ((yytext[1]=='%' && CG(asp_tags))
+ if ((yytext[1]=='%' && CG(short_tags))
|| (yytext[1]=='?' && CG(short_tags))) {
zendlval->value.str.val = yytext; /* no copying - intentional */
zendlval->value.str.len = yyleng;
@@ -1048,7 +1048,7 @@
<INITIAL>"<%" {
- if (CG(asp_tags)) {
+ if (CG(short_tags)) {
zendlval->value.str.val = yytext; /* no copying - intentional */
zendlval->value.str.len = yyleng;
zendlval->type = IS_STRING;
@@ -1111,7 +1111,7 @@
}
-<ST_IN_SCRIPTING>([#]|"//")([^nr?]|"?"[^>nr])*("?n"|"?rn")? { /* eat one line
comments */
+<ST_IN_SCRIPTING>([#]|"//")([^nr?%]|[?%][^>nr])*([?%]"n"|[?%]"rn")? { /* eat one line
+comments */
HANDLE_NEWLINE(yytext[yyleng-1]);
return T_COMMENT;
}
@@ -1151,7 +1151,7 @@
zendlval->value.str.len = yyleng;
zendlval->type = IS_STRING;
HANDLE_NEWLINES(yytext,yyleng);
- if (CG(asp_tags)) {
+ if (CG(short_tags)) {
BEGIN(INITIAL);
return T_CLOSE_TAG; /* implicit ';' at php-end tag */
} else {
---------------------------------------------------------------------------
[1999-12-31 20:36:34] [EMAIL PROTECTED]
I'm having a lex-related problem. I compiled PHP4.0b3 as a DSO in apache 1.3.9.
ASP-style tags and the code in them are displayed in the browser instead of being
parsed, even though the httpd.conf contains
php_flag asp_tags On
phpinfo() confirms that the Local Value of asp_tags flag is On.
All of the other tags styles are parsed correctly, but stuff like
<% echo ("You may optionally use ASP-style tags"); $variable = "boo"; %>
<%= $variable; # This is a shortcut for "<%echo .." %>
gets sent verbatim to the browser.
I've looked through zend-scanner.l and can't find anything wrong. I tried removing
the conditionals on asp_tags there, and changing the <% and %> to <@ and @>
in that file and in my PHP script to see if % was causing trouble, but neither of
those approaches worked. I also tried removing optimization when compiling
zend-scanner.c. No effect.
This is weird.
I was able to confirm that I was getting my changed scanner by breaking the rules for
identifying the short SGML tags. I found that there's a missing dependency because I
had to
rm libzend/libzend.la
in order to force the php module to be rebuilt after the scanner changed.
I'm using PHP compiled as a DSO with apache 1.3.9.
Compiled using flex version 2.5.4 and gcc 2.7.2.1.
---------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view the rest of the
comments, please view the bug report online.
Full Bug description available at: http://bugs.php.net/?id=3077
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]