Req #66914 [Com]: basename("/path/directory/") returns directory

From: Date: Thu, 20 Mar 2014 16:11:00 +0000
Subject: Req #66914 [Com]: basename("/path/directory/") returns directory
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-184844@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: mborchert71 at gmail dot com 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: Well, yes. thanks for the enlightenment... I won'T stand in the way of: POSIX.1-2001. ... although if find it a bit disturbing that stringHandling with '.' and the finalslash-basename concept... but thanks anyway.. this maybe closed... or can i close this... i dont know... it was my "virginity lost" in bug-reports... ;) Previous Comments: ------------------------------------------------------------------------ [2014-03-20 08:36:28] shm@php.net 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. ------------------------------------------------------------------------ [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

« previous php.bugs (#184844) next »