ID:               28148
 User updated by:  ca50015 at yahoo dot com
 Reported By:      ca50015 at yahoo dot com
-Status:           Bogus
+Status:           Closed
 Bug Type:         Compile Failure
 Operating System: windows 98 se
 PHP Version:      5.0.0RC1
 New Comment:

Thanks for Pollita and Derick.

I ought to have noticed that.


Previous Comments:
------------------------------------------------------------------------

[2004-04-25 22:35:58] [EMAIL PROTECTED]

This is indeed expected behavior, use "<{$tagname}[..." instead.

------------------------------------------------------------------------

[2004-04-25 22:12:21] [EMAIL PROTECTED]

It's seeing $tagname[^\\>]  as an array element (with an index of ^\>
which is, of course, invalid in an encapsed string context.

Not sure if this falls into "buggy" or "expected" beahvior as it's a
little gray...


------------------------------------------------------------------------

[2004-04-25 21:59:22] ca50015 at yahoo dot com

Description:
------------
Got parse error when double-quoted string contains variable.

[Code]
$pattern = "/\<$tagName[^\>]*\>/i"; 
[/Code]

[Error message]
Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE,
expecting T_STRING or T_VARIABLE or T_NUM_STRING in php5bug.php on line
6
[/Error message]

I'm using php5.0.0rc1 in windows 98 from command line
the command is: "php -f php5bug.php"

the same I got while test with php5.0.0RC2


Reproduce code:
---------------
<?php
$text = "<script></script>";
$tagName = 'script';

//These won't work      
$pattern = "/\<$tagName[^\>]*\>/i"; //backslash not escaped
$pattern = "/\\<$tagName[^\\>]*\\>/i"; // backslash escaped

//These work
$pattern = "/\<" . $tagName . "[^\>]*\>/i"; //backslash not escaped
$pattern = "/\\<" . $tagName . "[^\\>]*\\>/i"; // backslash escaped
?>

Expected result:
----------------
variables in double-quoted string could be altered


Actual result:
--------------

Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE,
expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\home\php5bug.php
on line 6




------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=28148&edit=1

Reply via email to