|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2010-02-12 20:28 UTC] geissert at debian dot org
Description:
------------
The test fails with the latest snapshot, 5.3.1 worked fine
Reproduce code:
---------------
echo "*** Testing strtolower() with all 256 chars ***\n";
for ($i=0; $i<=255; $i++){
$char = chr($i);
print(bin2hex($char))." => ".(bin2hex(strtolower("$char")))."\n";
}
Expected result:
----------------
*** Testing strtolower() with all 256 chars ***
00 => 00
01 => 01
02 => 02
03 => 03
04 => 04
05 => 05
06 => 06
07 => 07
08 => 08
09 => 09
0a => 0a
0b => 0b
0c => 0c
0d => 0d
0e => 0e
0f => 0f
...
bf => bf
c0 => c0
c1 => c1
c2 => c2
c3 => c3
c4 => c4
c5 => c5
c6 => c6
c7 => c7
c8 => c8
c9 => c9
ca => ca
cb => cb
cc => cc
cd => cd
ce => ce
cf => cf
d0 => d0
d1 => d1
...
Actual result:
--------------
*** Testing strtolower() with all 256 chars ***
00 => 00
01 => 01
02 => 02
03 => 03
04 => 04
05 => 05
06 => 06
07 => 07
08 => 08
09 => 09
0a => 0a
0b => 0b
0c => 0c
0d => 0d
0e => 0e
0f => 0f
...
bf => bf // error:
c0 => e0
c1 => e1
c2 => e2
c3 => e3
c4 => e4
c5 => e5
c6 => e6
c7 => e7
c8 => e8
c9 => e9
ca => ea
cb => eb
cc => ec
cd => ed
ce => ee
cf => ef
d0 => f0
d1 => f1
d2 => f2
d3 => f3
d4 => f4
d5 => f5
d6 => f6
d7 => d7
d8 => f8
d9 => f9
da => fa
db => fb
dc => fc
dd => fd
de => fe
df => df
e0 => e0 //the rest is fine
...
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 00:00:02 2025 UTC |
There is no magic here. All we are doing is calling the low-level tolower() function. I bet you can recreate the same thing with this: #include <stdio.h> #include <ctype.h> void main(void) { int ch; for(ch=0; ch<256; ch++) { printf("%x: %x\n",ch,tolower(ch)); } }Right, got it: --SKIPIF-- ... if (!setlocale(LC_ALL, 'en_US.UTF-8', 'en')) { ... while the test itself does: setlocale(LC_ALL, 'en-US.UTF-8'); it should use an underscore instead.