Bug #47691 [Ver->Csd]: strtr bug. Not replace unicode values from array, in binary string.

From: Date: Mon, 13 Apr 2015 12:50:51 +0000
Subject: Bug #47691 [Ver->Csd]: 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-192014@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=47691&edit=1

 ID:                 47691
 Updated by:         cmb@php.net
 Reported by:        strike at true-vision dot net
 Summary:            strtr bug. Not replace unicode values from array, in
                     binary string.
-Status:             Verified
+Status:             Closed
 Type:               Bug
 Package:            Strings related
 Operating System:   Fedora 8.0
 PHP Version:        6CVS-2009-03-17 (snap)
-Assigned To:        
+Assigned To:        cmb
 Block user comment: N
 Private report:     N

 New Comment:

The development of PHP 6 has been ceased, and even in PHP 7
there'll be no Unicode strings (u"..."). In all recent official PHP
versions the test script works as expected( see
<http://3v4l.org/SXlG3>), so I'm closing the ticket.


Previous Comments:
------------------------------------------------------------------------
[2009-05-05 22:41:36] fa@php.net

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"

------------------------------------------------------------------------
[2009-03-18 14:09:20] 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 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"

------------------------------------------------------------------------
[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 https://bugs.php.net/bug.php?id=47691&edit=1


Thread (4 messages)

« previous php.bugs (#192014) next »