RE: [PHP-DEV] Re: PHP 4.0 Bug #6999 Updated: dirname() returns em pty string for "/foo/"
| From: | Marc Boeren | Date: | Tue, 03 Oct 2000 15:19:18 +0000 |
| Subject: | RE: [PHP-DEV] Re: PHP 4.0 Bug #6999 Updated: dirname() returns em pty string for "/foo/" | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-34168@lists.php.net to get a copy of this message | ||
>I don't know either. I've checked C implementation of dirname()
>on NetBSD and it returns "/", as does dirname(1). dirname(1) on
>Solaris prints "/", too. So the POSIX.2 correct answer is
>probably to return "/".
If I check the manpage it says
'dirname - strip non-directory suffix from file name'
The problem is that it isn't getting a filename, but a directory-name
instead. The function doesn't actually do any checking for file or
directory. I still think it should return /foo, since that is the expected
returnvalue of a function named 'dirname'. On the other hand I can
understand returning / as well, so useers of dirname won't be confused when
they switch C/PHP...
On thing: document it properly!
Cheerio, Marc.