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

 ID:                 64995
 Updated by:         ras...@php.net
 Reported by:        svmk-tmsk at yandex dot ru
 Summary:            Function basename works icorrect with spaces
-Status:             Open
+Status:             Feedback
 Type:               Bug
 Package:            Filesystem function related
 Operating System:   Linux svmk-laptop 3.8.0-23-gener
 PHP Version:        5.4Git-2013-06-08 (Git)
 Block user comment: N
 Private report:     N

 New Comment:

Are you sure you are using UTF-8 and not CP1251 there? You set your locale to 
UTF8, and I tested your code with the UTF8:

echo basename('абв где');

And it works just fine.

eg.

php > echo basename('путь до каталога/абв  где');
абв  где

If you are using CP1251 you can try calling:

mb_internal_encoding("CP1251");

before your basename() call. Does it change anything?


Previous Comments:
------------------------------------------------------------------------
[2013-06-08 12:54:30] svmk-tmsk at yandex dot ru

Description:
------------
PHP version - PHP 5.4.9-4ubuntu2 (cli) (built: Mar 11 2013 16:05:09) 

Function basename works incorrect with spaces in cyrillic encoding. This 
function separates filename by a space. For example basename("www/abc defg") = 
"defg". It should be "abc defg". The letters should be in Cyrillic like 'абв 
где'.

1. Set locale ru_RU.UTF-8
2. Run this code echo basename('абв где');
3. basename return 'где'. basename must return 'абв где'.

Test script:
---------------
echo basename('абв где');

Expected result:
----------------
baseline function should't divide string by space.

Actual result:
--------------
basename('путь до каталога/абв  где') = 'где'


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



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

Reply via email to