#29542 [Com]: basename() has problem in supporting multi-byte chars.
| From: | p dot daintree at paradise dot net dot nz | Date: | Mon, 23 Aug 2004 09:03:56 +0000 |
| Subject: | #29542 [Com]: basename() has problem in supporting multi-byte chars. | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-65081@lists.php.net to get a copy of this message | ||
ID: 29542
Comment by: p dot daintree at paradise dot net dot nz
Reported By: ppmm at wuxinan dot net
Status: Open
Bug Type: Filesystem function related
Operating System: Windows 2000 Prof.
PHP Version: 5.0.0
New Comment:
Using linux 2.4.20 kernel php 5.0.0 on apache 1.3.31
$String = "abcdef - ghijk";
echo substr($String, strrpos($String," - "));
returns
" - ghijk"
but should and did return "ghijk" in previous versions.
Phil
Previous Comments:
------------------------------------------------------------------------
[2004-08-05 23:42:35] ppmm at wuxinan dot net
Description:
------------
when path has multi-byte chars, basename() does not return correct file
basename. I did not have this problem in PHP 4.3.7. In the example,
$hehe variable has two gb2312-encoded chinese chars. This might relate
to setlocale or something like that.
Reproduce code:
---------------
$hehe = "hehe/ºÕºÕ haha kkk";
echo basename($hehe)."\n";
echo substr($hehe, strrpos($hehe, "/")+1);
Expected result:
----------------
ºÕºÕ haha kkk
ºÕºÕ haha kkk
Actual result:
--------------
haha kkk
ºÕºÕ haha kkk
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=29542&edit=1