php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #22415 strtolower()
Submitted: 2003-02-25 08:05 UTC Modified: 2003-02-25 12:43 UTC
From: admin at naxe dot net Assigned:
Status: Not a bug Package: Strings related
PHP Version: 4.3.0 OS: Linux Red Hat v7.3
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: admin at naxe dot net
New email:
PHP Version: OS:

 

 [2003-02-25 08:05 UTC] admin at naxe dot net
Hi,

I make massive use of PHP so I tested many times before report this that I think is a bug:

This is the example script:

$ch=chr(180);
echo $ch;
echo strtolower($ch);
echo strtoupper($ch);

The result will be this: ??? instead of this: ???

This bug seems that occur only with PHP v4.3.0, I tested it also with PHP v4.2.2 ad it was ok.

I uploaded the script on two different server of mine:

http://www.dez.it/test/strtolower.php here with PHP v4.2.2 (http://www.dez.it/test/phpinfo.php for phpinfo)

http://www.postare.it/test/strtolower.php here with PHP v4.3.0 (http://www.postare.it/test/phpinfo.php for phpinfo)

As said the first link works ok, the seconds has this strange behaviour, it modify chr(180) to chr(184). I haven't tested with all the ascii set.

I hope this report was useful.

Good debug.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-02-25 08:18 UTC] hholzgra@php.net
from the manual page on strtolower:
"Note that 'alphabetic' is determined by the current locale. "

are you sure that this is not just a locale settings problem?
 [2003-02-25 08:20 UTC] moriyoshi@php.net
strtolower's behaviour depends on the locale settings (LC_CTYPE), and the settings are different on each server,
so the reported behaviour seems to be quite expectable for me. Setting LANG=C would solve your problem?





 [2003-02-25 08:24 UTC] moriyoshi@php.net
And also try inserting

setlocale(LC_CTYPE, "C");

on top of your script.

 [2003-02-25 08:58 UTC] admin at naxe dot net
Hi, thanks for your replies.

As you can see on my phpinfo() I have this environment setting:

LANG  it_IT@euro

I think it was from the Red Hat v7.3 installation.

I tested the script, as you suggested, with LANG=C (the same language settings that I have on the other server) and it works.

But I think that this behaviour is still very strange, why my setting of it_IT will produce this problem: strtolower(chr(180)) results in chr(184)?

I think this is an important issue for code portability.

Thanks.
 [2003-02-25 12:41 UTC] michael dot mauch at gmx dot de
Your LANG it_IT@euro uses the ISO-8859-15 character set - that's the one with the Euro sign. At character position 180 it has a "Z" with a little "v" (caron) above, and at character position it has the "z" with the little "v" (caron) above - so strtolower() is correct.

See "man iso-8859-15", if your system has that man page.
 [2003-02-25 12:43 UTC] moriyoshi@php.net
Marking as bogus because this is not a bug at all...

 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Jan 05 09:01:27 2025 UTC