Req #66914 [Com]: basename("/path/directory/") returns directory
| From: | shm@php.net | Date: | Thu, 20 Mar 2014 08:36:28 +0000 |
| Subject: | Req #66914 [Com]: basename("/path/directory/") returns directory | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-184837@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=66914&edit=1
ID: 66914
Comment by: shm@php.net
Reported by: mborchert71 at gmail dot com
Summary: basename("/path/directory/") returns directory
Status: Open
Type: Feature/Change Request
Package: *Directory/Filesystem functions
Operating System: Linux Debian/Ubuntu/Mint
PHP Version: 5.4.26
Block user comment: N
Private report: N
New Comment:
Accroding to glibc's man basename(3):
[...]
The functions dirname() and basename() break a null-terminated pathname string
into directory and filename components. In the usual case, dirname() returns
the string up to, but not including, the final '/', and basename() returns the
component following the final '/'. Trailing '/' characters are not counted as
part of the pathname.
[...]
Our implementation behaves the same.
Previous Comments:
------------------------------------------------------------------------
[2014-03-16 19:10:12] mborchert71 at gmail dot com
Similar "unexpected" is, that
dirname("") returns "."
------------------------------------------------------------------------
[2014-03-16 19:01:48] mborchert71 at gmail dot com
Description:
------------
basename should return empty string on trailing slash strings
Test script:
---------------
echo basename("/test/path/");//returns path
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=66914&edit=1