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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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-2019 The PHP Group
All rights reserved.
Last updated: Sat Feb 23 08:01:25 2019 UTC