#47691 [Opn]: strtr bug. Not replace unicode values from array, in binary string.

From: Date: Wed, 18 Mar 2009 14:09:21 +0000
Subject: #47691 [Opn]: strtr bug. Not replace unicode values from array, in binary string.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-134865@lists.php.net to get a copy of this message
ID: 47691 User updated by: strike at true-vision dot net Reported By: strike at true-vision dot net Status: Open Bug Type: Strings related Operating System: Fedora 8.0 PHP Version: 6CVS-2009-03-17 (snap) New Comment: Description: ------------ Found bug in function strtr... Not replace unicode values from array, in binary string. Reproduce code: --------------- <?php $a = (binary)"AAA"; // In my code I use file_get_contents // function retrun binary value $b = array("AAA" => "BBB"); $c = strtr($a, $b); var_dump($a); var_dump($b); var_dump($c); ?> Expected result: ---------------- string(3) "AAA" array(1) { [u"AAA"]=> unicode(3) "BBB" } string(3) "BBB" Actual result: -------------- string(3) "AAA" array(1) { [u"AAA"]=> unicode(3) "BBB" } string(3) "AAA" Previous Comments: ------------------------------------------------------------------------ [2009-03-17 14:22:09] strike at true-vision dot net Description: ------------ Found bug in function strtr... Not replace unicode values from array, in binary string. Reproduce code: --------------- <php $a = (binary)"AAA"; // In my code I use file_get_contents // function retrun finary value $b = array("AAA" => "BBB"); $c = strtr($a, $b); var_dump($a); var_dump($b); var_dump($c); ?> Expected result: ---------------- string(3) "AAA" array(1) { [u"AAA"]=> unicode(3) "BBB" } string(3) "AAA" Actual result: -------------- This is bug ? ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=47691&edit=1

« previous php.bugs (#134865) next »