#45279 [Opn->WFx]: Results of dirname() on paths ending with a /
| From: | vrana@php.net | Date: | Wed, 05 Nov 2008 11:18:46 +0000 |
| Subject: | #45279 [Opn->WFx]: Results of dirname() on paths ending with a / | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-1361@lists.php.net to get a copy of this message | ||
ID: 45279
Updated by: vrana@php.net
Reported By: ralph at deboom dot biz
-Status: Open
+Status: Wont fix
Bug Type: Documentation problem
Operating System: Debian Etch 4.0+
PHP Version: 5.2.6
New Comment:
dirname() and basename() clearly states that it accepts a path to a
file, not a directory.
Previous Comments:
------------------------------------------------------------------------
[2008-08-01 17:21:01] pajoye@php.net
Marked as "Won't fix" from a dev point of view, move to "Documentation"
------------------------------------------------------------------------
[2008-08-01 17:17:24] ralph at deboom dot biz
Then please do update the docs?
------------------------------------------------------------------------
[2008-08-01 14:42:01] dmitry@php.net
The current behavior is consistent and it won't be changed, as it may
break existent code.
------------------------------------------------------------------------
[2008-06-20 11:13:41] ralph at deboom dot biz
~_~ Oops, forgot the return $dirname:
-------------------------
<?php
function __dirname($dirname) {
if (substr($dirname, -1, 1) == '/' || substr($dirname, -1, 1)
== '\\') {
$dirname = dirname($dirname.'.');
}
else {
$dirname = dirname($dirname);
}
return $dirname;
}
------------------------------------------------------------------------
[2008-06-20 11:12:21] ralph at deboom dot biz
Ok super! :)
-------------------------------
I got a workaround for the people who are using the older versions:
<?php
function __dirname($dirname) {
if (substr($dirname, -1, 1) == '/' || substr($dirname, -1, 1)
== '\\') {
$dirname = dirname($dirname.'.');
}
else {
$dirname = dirname($dirname);
}
}
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/45279
--
Edit this bug report at http://bugs.php.net/?id=45279&edit=1