|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #78817 pathinfo() on filenames starting with utf-8 character fails
Submitted: 2019-11-15 10:41 UTC Modified: 2019-11-15 10:51 UTC
From: jasverix at gmail dot com Assigned:
Status: Not a bug Package: Filesystem function related
PHP Version: 7.2.24 OS: Debian Linux
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.
Block user comment
Status: Assign to:
Bug Type:
From: jasverix at gmail dot com
New email:
PHP Version: OS:


 [2019-11-15 10:41 UTC] jasverix at gmail dot com
We have a filename starting with a non-ASCII filename character like "Æ", "Ø" or "Å". Then we try to get the filename without extension using PATHINFO_FILENAME.

PHP will trim the first character from the resulting string.

Test script:

$fileName = 'ÅfileÅnameÅ.docx';

// outputs "fileÅnameÅ" - missing starting character
echo pathinfo($fileName, PATHINFO_FILENAME) . "\n";

Expected result:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2019-11-15 10:42 UTC] jasverix at gmail dot com
PHP Version:
PHP 7.2.24-1+0~20191026.31+debian10~1.gbpbbacde (cli) (built: Oct 26 2019 14:20:35) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.24-1+0~20191026.31+debian10~1.gbpbbacde, Copyright (c) 1999-2018, by Zend Technologies
 [2019-11-15 10:51 UTC]
-Status: Open +Status: Not a bug
 [2019-11-15 10:51 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

This is documented - see

> Caution
> pathinfo() is locale aware, so for it to parse a path containing multibyte characters correctly, the matching locale must be set using the setlocale() function.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sat Jul 31 13:01:25 2021 UTC