Bug #80509 [Opn->Fbk]: A bug of basename function

From: Date: Mon, 14 Dec 2020 11:08:30 +0000
Subject: Bug #80509 [Opn->Fbk]: A bug of basename function
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-231062@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=80509&edit=1 ID: 80509 Updated by: cmb@php.net Reported by: amanjiang at gmail dot com Summary: A bug of basename function -Status: Open +Status: Feedback Type: Bug Package: *General Issues Operating System: Windows 10 PHP Version: 7.4.13 -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: 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? Previous Comments: ------------------------------------------------------------------------ [2020-12-13 11:15:32] 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> ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=80509&edit=1

« previous php.bugs (#231062) next »