php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27457 Problem with strtr() and translation array
Submitted: 2004-03-02 03:40 UTC Modified: 2004-03-18 05:31 UTC
From: solace at ezmail dot ru Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 5CVS-2004-03-09 OS: *
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: solace at ezmail dot ru
New email:
PHP Version: OS:

 

 [2004-03-02 03:40 UTC] 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]

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-03-02 04:12 UTC] derick@php.net
Recategorize bug.
 [2004-03-18 05:31 UTC] derick@php.net
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.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 12:01:29 2024 UTC