Edit report at https://bugs.php.net/bug.php?id=61309&edit=1
ID: 61309 Updated by: paj...@php.net Reported by: ku at digitaldolphins dot jp Summary: DBCS included UNC path broken due to incorrect toupper usage -Status: Open +Status: Duplicate Type: Bug Package: Directory function related Operating System: Windows Server 2008 R2 Foundatio PHP Version: trunk-SVN-2012-03-07 (snap) Block user comment: N Private report: N New Comment: We already have reports about that. Full unicode/wildchar support is being worked on. Previous Comments: ------------------------------------------------------------------------ [2012-03-07 02:50:09] ku at digitaldolphins dot jp Description: ------------ scandir() fails on all of following conditions: - use UNC path with DBCS character(s). - second byte in one DBCS character includes lower letter ('a' to 'z'). for example: \\DD5\ãã©ã«ã ("ãã©ã«ã" means "folder") each character -> to byte array as CP932 (aka Shift_JIS) -> to ascii: ã -> 83 74 -> .t ã© -> 83 48 -> .H ã« -> 83 8B -> .. ã -> 83 5F -> ._ incorrect toupper usage brings "ãµã©ã«ã" from "ãã©ã«ã". Expected result shows: By using pathced php5, it is looking for right place "\\DD5\ãã©ã«ã" (ok). [CASE1] in Actual result shows: By using php5 snap, it is looking for wrong place "\\DD5\ãµã©ã«ã" (wrong). network path is not found! [CASE2] in Actual result shows: By using php5 snap. I prepared a UNC folder with wrong name "ãµã©ã«ã". About my fix method: - toupper/tolower is ok, however path consists from "characters", not "bytes". - try _mbsinc or such to advance pointer in "character" unit. Test script: --------------- <?php echo print_r(scandir("\\\\DD5\\ãã©ã«ã")); ?> Expected result: ---------------- C:\php-sdk\php54dev\vc9\x86\php5.4-201203070030>Release_TS\php.exe \php5\test.php Array ( [0] => . [1] => .. [2] => Ok. it is 'fo-ru-da'.txt ) 1 Actual result: -------------- [CASE1] C:\php5>php.exe test.php PHP Warning: scandir(\\DD5\ãã©ã«ã,\\DD5\ãã©ã«ã): ãããã¯ã¼ã¯åãè¦ã¤ããã¾ããã (code: 67) in C:\php5\test.php on line 3 PHP Warning: scandir(\\DD5\ãã©ã«ã): failed to open dir: Permission denied in C:\php5\test.php on line 3 PHP Warning: scandir(): (errno 13): Permission denied in C:\php5\test.php on line 3 1 [CASE2] C:\php5>php.exe test.php Array ( [0] => . [1] => .. [2] => Wrong. it is 'sa-lo-ru-da'.txt ) 1 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=61309&edit=1