#27457 [Asn->Csd]: Problem with strtr() and translation array
| From: | derick@php.net | Date: | Thu, 18 Mar 2004 10:31:15 +0000 |
| Subject: | #27457 [Asn->Csd]: Problem with strtr() and translation array | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-56614@lists.php.net to get a copy of this message | ||
ID: 27457
Updated by: derick@php.net
Reported By: solace at ezmail dot ru
-Status: Assigned
+Status: Closed
Bug Type: Zend Engine 2 problem
Operating System: *
PHP Version: 5CVS-2004-03-09
Assigned To: andi
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2004-03-02 04:12:56] derick@php.net
Recategorize bug.
------------------------------------------------------------------------
[2004-03-02 03:40:08] solace at ezmail dot ru
Description:
------------
I wanted to test compatibility of my scripts with the latest php5 beta
and discovered very strange results.
Well, something is wrong with strtr() function working with translation
array. It worked fine with php 4.x.x.
But strtr() with strings still works.
I'm using command-line php.exe with -n switch, without php.ini or any
modules.
Reproduce code:
---------------
$test = "Dot in brackets [.]\n";
$test = strtr($test, array('.' => '0'));
// doesn't work ???
$test = strtr($test, array('0' => '.'));
echo $test;
// but this works!!!
$test = strtr($test, '0', '.');
echo $test;
Expected result:
----------------
Dot in brackets [.]
Actual result:
--------------
Dot in brackets [0]
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=27457&edit=1