php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #67756 basename() malfunctions with non-ASCII characters
Submitted: 2014-08-04 10:29 UTC Modified: 2016-10-14 16:31 UTC
From: bugs dot php dot net at dw-perspective dot org dot uk Assigned: cmb (profile)
Status: Duplicate Package: *Directory/Filesystem functions
PHP Version: 5.5.15 OS: Linux (Fedora)
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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: bugs dot php dot net at dw-perspective dot org dot uk
New email:
PHP Version: OS:

 

 [2014-08-04 10:29 UTC] bugs dot php dot net at dw-perspective dot org dot uk
Description:
------------
basename() returns a false result if the paramater begins with a non-ASCII character:


Confirmed on PHP 5.5.15 and 5.4.30.

The bug does not occur if the non-ASCII character is not first.

Reported previously on EOL-ed PHP version: https://bugs.php.net/bug.php?id=62119 - no resolution yet exists.

Test script:
---------------
Shell script to demonstrate problem:

# echo -n "uploads/й.png" > filename.txt

# LANG=C php -r 'echo basename(file_get_contents("filename.txt"))."\n";'
.png

# LANG=en_US.UTF-8 php -r 'echo basename(file_get_contents("filename.txt"))."\n";'
й.png

Shell script to demonstrate non-existence of problem if the non-ASCII character is not first:

# echo -n "uploads/xй.png" > filename.txt
# LANG=C php -r 'echo basename(file_get_contents("filename.txt"))."\n";'
xй.png


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-10-14 16:31 UTC] cmb@php.net
-Status: Open +Status: Duplicate -Assigned To: +Assigned To: cmb
 [2016-10-14 16:31 UTC] cmb@php.net
Duplicate of bug #62119.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 22:01:28 2024 UTC