#26426 [NEW]: strtr translate numbers with "Array" when using replace_pairs
| From: | elias dot norstrom at lunchinfo dot com | 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åpoli987654321";
$arrTransformChars[] = array('Å' => 'Å');
$arrTransformChars[] = array('Ä' => 'Ä');
$arrTransformChars[] = array('Ö' => 'Ö');
$arrTransformChars[] = array('å' => 'å');
$arrTransformChars[] = array('ä' => 'ä');
$arrTransformChars[] = array('ö' => 'ö');
echo $strSearchWord . "<br>";
$strSearchWord = strtr($strSearchWord,$arrTransformChars);
echo $strSearchWord . "<br>";
exit;
?>
Expected result:
----------------
abc123å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