|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2009-03-17 14:22 UTC] 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 ?
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Dec 03 09:00:01 2025 UTC |
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"Verified on Debian lenny: (fa@debian):(~/code/src/php6) $ ~/local/php6/bin/php ~/tmp/strtr_47691.php string(3) "AAA" array(1) { [u"AAA"]=> unicode(3) "BBB" } string(3) "AAA" Seems to be ok on FreeBSD 7.1: (fa@freebsd):(/usr/home/fa/code/php6) $ ~/local/test/bin/php ~/tmp/strtr_47691.php string(3) "AAA" array(1) { ["AAA"]=> string(3) "BBB" } string(3) "BBB"