Bug #14217 Updated: Strange bug with strtr() function
| From: | derick@php.net | Date: | Sat, 25 May 2002 00:30:51 +0000 |
| Subject: | Bug #14217 Updated: Strange bug with strtr() function | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-8475@lists.php.net to get a copy of this message | ||
ID: 14217
Updated by: derick@php.net
Reported By: akul@otamedia.com
-Status: Open
+Status: Bogus
Bug Type: Strings related
Operating System: windows 98
PHP Version: 4.0.6
New Comment:
Thank you for taking the time to report a problem with PHP.
Unfortunately your version of PHP is too old -- the problem
might already be fixed. Please download a new PHP
version from http://www.php.net/downloads.php
If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.
Previous Comments:
------------------------------------------------------------------------
[2001-11-25 10:26:41] akul@otamedia.com
I have very simple function to convert some sumbols to underscores:
function to_tag($text)
{
$from=" \"\t\\/:#$%^&*()=+-!`'~?<>[],.";
$retval=strtr($text,$from,str_repeat('_',strlen($from)));
// debug output
echo "\r\n<BR>[$text] >> [$retval]";
return $retval;
}
And I have such string (first world is russian, Win-1251): "àâòîðñêàÿ
d'fusion"
On simple example all is Ok:
<?
include_once('tag.inc.php');
to_tag("àâòîðñêàÿ d'fusion");
?>
X-Powered-By: PHP/4.0.7-dev
Content-type: text/html; charset=windows-1251
<BR>[àâòîðñêàÿ d'fusion] >> [àâòîðñêàÿ__d_fusion]
But!
If this function called from more complex real code, ['] doesn't
converted:
Function using to_tag():
function getPropXML($FID,$TID)
{
debug("getPropXML($FID,$TID)");
$value=$this->getProp($FID,$TID);
$target=$this->getCopy($TID);
return t(to_tag($target->Name)
,t('path',$this->getPath($TID))
.t('value',cdata($value))
.t('Parent',$this->getPath($target->ParentID)));
}
Debug output for object with this string:
...
<BR>[Ðåñòîðàí] >> [Ðåñòîðàí]
<BR>[àâòîðñêàÿ d'fusion] >> [àâòîðñêàÿ_d'fusion]
<BR>[$25-70] >> [_25_70]
...
I tried to clear situation and find point of bug, but can't :(
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=14217&edit=1