PHP 4.0 Bug #7873 Updated: Dirname inconsistency
| From: | stas@php.net | Date: | Sun, 19 Nov 2000 14:06:33 +0000 |
| Subject: | PHP 4.0 Bug #7873 Updated: Dirname inconsistency | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-38497@lists.php.net to get a copy of this message | ||
ID: 7873
Updated by: stas
Reported By: trifid@redigy.cz
Status: Closed
Bug Type: *Function Specific
Assigned To:
Comments:
This is the same way as "pwd" function behaves, so I guess
your loginc od always adding / is not correct. Or you have
to live with // on the root path. This is because root path
is different from other pathes - / is actually its name,
while on other pathes / is just a delimiter. Your patch
makes root path to be "", which is obviously wrong.
Previous Comments:
---------------------------------------------------------------------------
[2000-11-18 11:39:36] trifid@redigy.cz
The last change in ext/standard/string.c brought very bad inconsistency into
dirname behaviour:
echo dirname("/foo/bar/")."/foobar"; => /foo/foobar
echo dirname("/foo/")."/foobar"; => //foobar
the function should everytime return a path with or without a slash at the end,
but always the same.
I created a very simple patch that will stop returning a slash at the end in any
case:
--- string.c.orig Sat Nov 18 17:00:28 2000
+++ string.c Sat Nov 18 17:04:53 2000
@@ -714,8 +714,7 @@
}
if (end < path) {
/* The path only contained slashes */
- path[0] = DEFAULT_SLASH;
- path[1] = '