php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #80509 A bug of basename function
Submitted: 2020-12-13 11:15 UTC Modified: 2020-12-27 04:22 UTC
From: amanjiang at gmail dot com Assigned: cmb (profile)
Status: No Feedback Package: *General Issues
PHP Version: 7.4.13 OS: Windows 10
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: amanjiang at gmail dot com
New email:
PHP Version: OS:

 

 [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>


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-12-14 11:08 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2020-12-14 11:08 UTC] cmb@php.net
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?
 [2020-12-27 04:22 UTC] php-bugs at lists dot php dot net
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.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 10:01:29 2024 UTC