Edit report at http://bugs.php.net/bug.php?id=50203&edit=1

 ID:                 50203
 Comment by:         lost dot guadelenn at gmail dot com
 Reported by:        vadim at sukhomlinov dot ru
 Summary:            Apache +mod_php can't load script with non-ASCII
                     name
 Status:             Duplicate
 Type:               Bug
 Package:            Apache2 related
 Operating System:   win32 only - Windows XP SP3
 PHP Version:        5.3.0
 Block user comment: N
 Private report:     N

 New Comment:

A note to developers:

Apache has api for path manipulation:
http://apr.apache.org/docs/apr/0.9/group__apr__filepath.html

Note function apr_filepath_encoding() which retrieves current path
encoding.

Also note win32 function GetShortPathName() which converts any valid
long pathname to 8.3 ascii format.


Previous Comments:
------------------------------------------------------------------------
[2011-03-17 14:13:23] paj...@php.net

There is already a feature request for Unicode Filesystem support. And
no, it is 

not implemeneted yet.

------------------------------------------------------------------------
[2011-03-17 14:08:30] lost dot guadelenn at gmail dot com

The bug is still present in php 5.3.5 and apache 2.2.17.

(Both are latest stable versions).

OS is Win7 64 bit (php and apache are 32-bit).

------------------------------------------------------------------------
[2011-01-17 21:58:26] tsanchev at gmail dot com

Directory listing from pache:







Index of /cosmetic-academy



Parent Directory

assets/

pl0_p0_Козметик Академи_html.php

ддадада д асд асдdasdasd aдасффс.txt







when try to execute the sctript in the directory i get this error:





Warning: Unknown: failed to open stream: No such file or directory in
Unknown on 

line 0



Fatal error: Unknown: Failed opening required 'D:/web/www/cosmetic-

academy/pl0_p0_Козметик Академи_html.php'
(include_path='.;C:\php5\pear') in 

Unknown on line 0





if the name contain only ascii chars it works perfectly

------------------------------------------------------------------------
[2009-11-17 10:30:38] vadim at sukhomlinov dot ru

Description:
------------
When I use Apache 2.2.14 + PHP 5.3 standalone and request such script
directly by name it doesn't start (at least with mod_php), but in log
files I see something like:

[error] [client 127.0.0.1] PHP Fatal error: Unknown: Failed opening
required
'E:/www/test2/\xd0\x9d\xd0\xbe\xd0\xb2\xd0\xbe\xd1\x81\xd1\x82\xd0\xb8.php'
(include_path='.;C:\\php5\\pear') in Unknown on line 0, referer:
http://test2.ru/



I discovered this is because PHP doesn't translate UTF-8 filename passed
from Apache to coding (Unicode-16?) used by Windows, and thus can't open
it. It works perfectly on Linux as Apache, PHP & Linux filesystem use
same UTF-8...



Having this feature is useful for creating SEO-optimized sites with URLs
containing keywords. I don't ask to fix Unicode in general, but at least
for Windows, where it's known Apache will receive link as UTF-8 and pass
it as is to PHP, we can translate it into correct encoding before
calling system functions. I guess this is couple lines of code for
Windows build.

Reproduce code:
---------------
1. take any .php script and rename it to any name with UTF-8 2 byte+
symbols. I used russian íîâîñòè.php.

2. Configure Apache on Windows to use PHP as module (loadmodule)

3. Try to request this script from browser





Expected result:
----------------
Script won't load with 500 code. However, it runs when it's name has
only ASCII characters.

Actual result:
--------------
[error] [client 127.0.0.1] PHP Fatal error: Unknown: Failed opening
required
'E:/www/test2/\xd0\x9d\xd0\xbe\xd0\xb2\xd0\xbe\xd1\x81\xd1\x82\xd0\xb8.php'
(include_path='.;C:\\php5\\pear') in Unknown on line 0, referer:
http://test2.ru/


------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=50203&edit=1

Reply via email to