Bug #64995 [Fbk->NoF]: Function basename works icorrect with spaces

From: Date: Tue, 15 Oct 2013 11:54:44 +0000
Subject: Bug #64995 [Fbk->NoF]: Function basename works icorrect with spaces
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-182247@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=64995&edit=1 ID: 64995 Updated by: php-bugs@lists.php.net Reported by: svmk-tmsk at yandex dot ru Summary: Function basename works icorrect with spaces -Status: Feedback +Status: No 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) Private report: N New Comment: No feedback was provided. The bug is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so and change the status of the bug back to "Re-Opened". Thank you. Previous Comments: ------------------------------------------------------------------------ [2013-06-08 15:49:39] rasmus@php.net 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? ------------------------------------------------------------------------ [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

« previous php.bugs (#182247) next »