From: matteo at beccati dot com Operating system: Debian GNU/Linux 3.0 PHP version: 4.3.1 PHP Bug Type: Strings related Bug description: Cascading assignments to strings with curly braces broken
When using cascading assignments to strings and curly braces, to change characters within strings, only the last character is changed to the right value. Other characters become NUL (0x00). <? $wrong = $correct = 'abcdef'; $correct{1} = '*'; $correct{3} = '*'; $correct{5} = '*'; // This produces the $wrong{1} = $wrong{3} = $wrong{5} = '*'; echo $correct."\n".$wrong."\n\n"; echo urlencode($correct)."\n"."\n".urlencode($wrong)."\n"; ?> The resulting output is: a*c*e* ace* a%2Ac%2Ae%2A a%00c%00e%2A I also tested it on a old PHP 4.2.0-dev, and it gives the same result. -- Edit bug report at http://bugs.php.net/?id=22592&edit=1 -- Try a CVS snapshot: http://bugs.php.net/fix.php?id=22592&r=trysnapshot Fixed in CVS: http://bugs.php.net/fix.php?id=22592&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=22592&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=22592&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=22592&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=22592&r=support Expected behavior: http://bugs.php.net/fix.php?id=22592&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=22592&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=22592&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=22592&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=22592&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=22592&r=dst IIS Stability: http://bugs.php.net/fix.php?id=22592&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=22592&r=gnused