#26426 [NEW]: strtr translate numbers with "Array" when using replace_pairs

From: Date: Wed, 26 Nov 2003 15:30:02 +0000
Subject: #26426 [NEW]: strtr translate numbers with "Array" when using replace_pairs
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-51104@lists.php.net to get a copy of this message
From: elias dot norstrom at lunchinfo dot com Operating system: Linux Debian 2.4.21 PHP version: 4.3.3 PHP Bug Type: Scripting Engine problem Bug description: strtr translate numbers with "Array" when using replace_pairs Description: ------------ Trying to translate swedish encoded characters with strtr function using replace_pairs. The function translate numbers from 0 to sizeof(replace_pairs-array) to the string "Array". See example to reproduce. Reproduce code: --------------- <?php $strSearchWord = "abc123&aring;poli987654321"; $arrTransformChars[] = array('&Aring;' => 'Å'); $arrTransformChars[] = array('&Auml;' => 'Ä'); $arrTransformChars[] = array('&Ouml;' => 'Ö'); $arrTransformChars[] = array('&aring;' => 'å'); $arrTransformChars[] = array('&auml;' => 'ä'); $arrTransformChars[] = array('&ouml;' => 'ö'); echo $strSearchWord . "<br>"; $strSearchWord = strtr($strSearchWord,$arrTransformChars); echo $strSearchWord . "<br>"; exit; ?> Expected result: ---------------- abc123&aring;poli987654321 abc123åpoli987654321 Actual result: -------------- abc123åpoli987654321 abcArrayArrayArrayåpoli9876ArrayArrayArrayArrayArray -- Edit bug report at http://bugs.php.net/?id=26426&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=26426&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=26426&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=26426&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=26426&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=26426&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=26426&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=26426&r=support Expected behavior: http://bugs.php.net/fix.php?id=26426&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=26426&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=26426&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=26426&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=26426&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=26426&r=dst IIS Stability: http://bugs.php.net/fix.php?id=26426&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=26426&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=26426&r=float

« previous php.bugs (#51104) next »