|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2020-12-13 11:15 UTC] amanjiang at gmail dot com
Description:
------------
The basename function *sometimes* cannot get the file name correctly in a path that containing certain Chinese characters.
The following test script will be echo (If you restart the Apache server several times, this bug may occur; obviously, there are two wrong results):
显示
开示/开示/开示/开示/开示/开示/开示/开示/开示/开示
明示
陈示
表示
标示
指示
展示
检示/检示/检示/检示/检示/检示/检示/检示/检示/检示
提示
告示
暗示
Test script:
---------------
<!doctype html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<?php
echo basename('显示/显示/显示/显示/显示/显示/显示/显示/显示/显示').'<br>';
echo basename('开示/开示/开示/开示/开示/开示/开示/开示/开示/开示').'<br>';
echo basename('明示/明示/明示/明示/明示/明示/明示/明示/明示/明示').'<br>';
echo basename('陈示/陈示/陈示/陈示/陈示/陈示/陈示/陈示/陈示/陈示').'<br>';
echo basename('表示/表示/表示/表示/表示/表示/表示/表示/表示/表示').'<br>';
echo basename('标示/标示/标示/标示/标示/标示/标示/标示/标示/标示').'<br>';
echo basename('指示/指示/指示/指示/指示/指示/指示/指示/指示/指示').'<br>';
echo basename('展示/展示/展示/展示/展示/展示/展示/展示/展示/展示').'<br>';
echo basename('检示/检示/检示/检示/检示/检示/检示/检示/检示/检示').'<br>';
echo basename('提示/提示/提示/提示/提示/提示/提示/提示/提示/提示').'<br>';
echo basename('告示/告示/告示/告示/告示/告示/告示/告示/告示/告示').'<br>';
echo basename('暗示/暗示/暗示/暗示/暗示/暗示/暗示/暗示/暗示/暗示').'<br>';
?>
</body>
</html>
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Dec 14 13:00:01 2025 UTC |
First, basename() is locale aware, so this issue might be related to that. Which locale do you use? You can check with echo setlocale(LC_CTYPE, 0); Does the locale change for different requests? Also, do you get these erroneous results with OPcache enabled or disabled?