From: ca50015 at yahoo dot com Operating system: windows 98 se PHP version: 5.0.0RC1 PHP Bug Type: Compile Failure Bug description: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARI
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 bug report at http://bugs.php.net/?id=28148&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=28148&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=28148&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=28148&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=28148&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=28148&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=28148&r=needscript Try newer version: http://bugs.php.net/fix.php?id=28148&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=28148&r=support Expected behavior: http://bugs.php.net/fix.php?id=28148&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=28148&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=28148&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=28148&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28148&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=28148&r=dst IIS Stability: http://bugs.php.net/fix.php?id=28148&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=28148&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=28148&r=float