ID:               26426
 Updated by:       [EMAIL PROTECTED]
 Reported By:      elias dot norstrom at lunchinfo dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         Scripting Engine problem
 Operating System: Linux Debian 2.4.21
 PHP Version:      4.3.3
 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

You're filling the array wrongly:

$arrTransformChars['&Aring'] = '....

you're creating a 2d array, which is not what this function wants.


Previous Comments:
------------------------------------------------------------------------

[2003-11-26 10:30:02] elias dot norstrom at lunchinfo dot com

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 this bug report at http://bugs.php.net/?id=26426&edit=1

Reply via email to