|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
Patchesphp54_dbcs_win_unc_1 (last revision 2012-03-07 02:50 UTC by ku at digitaldolphins dot jp)Pull RequestsHistoryAllCommentsChangesGit/SVN commits
[2012-03-07 09:02 UTC] pajoye@php.net
[2012-03-07 09:02 UTC] pajoye@php.net
-Status: Open
+Status: Duplicate
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 12:00:02 2025 UTC |
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