From: [EMAIL PROTECTED]
Operating system: windows 98
PHP version: 4.0.6
PHP Bug Type: Strings related
Bug description: Strange bug with strtr() function
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 bug report at: http://bugs.php.net/?id=14217&edit=1
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]