#31341 [NEW]: escape on curly inconsistent

From: Date: Thu, 30 Dec 2004 01:57:50 +0000
Subject: #31341 [NEW]: escape on curly inconsistent
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-71261@lists.php.net to get a copy of this message
From:             nmuhayimana at semanticdesigns dot com
Operating system: Windows NT
PHP version:      Irrelevant
PHP Bug Type:     Strings related
Bug description:  escape on curly inconsistent

Description:
------------
Php suppresses the backslash before left curly brace using
"action at distance", violating the "principle of least surprise".

Apparently the backslash is suppressed if there is any non-escaped dollar
sign any where in the string.  

Reproduce code:
---------------
<?php

echo ("$     \{    \n"); 
echo ("      \{   $\n"); 
echo ("      \{$   \n");
echo ("      $\{   \n");
echo ("      \$\{  \n");
echo ("      \{\$  \n");
echo ("\$    \{    \n");
echo ("      \{  \$\n");
echo ("%     \{    \n");
?>

Expected result:
----------------
$     \{      
      \{   $   
      {$         
      $\{     
      $\{  
      \{$  
$    \{    
      \{  $
%     \{    

Actual result:
--------------
$     {    
      {   $
      {$   
      ${   
      $\{  
      \{$  
$    \{    
      \{  $
%     \{    

-- 
Edit bug report at http://bugs.php.net/?id=31341&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=31341&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=31341&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=31341&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=31341&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=31341&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=31341&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=31341&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=31341&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=31341&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=31341&r=notwrong
Not enough info:             http://bugs.php.net/fix.php?id=31341&r=notenoughinfo
Submitted twice:             http://bugs.php.net/fix.php?id=31341&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=31341&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=31341&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=31341&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=31341&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=31341&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=31341&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=31341&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=31341&r=mysqlcfg


Thread (5 messages)

« previous php.bugs (#71261) next »