|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2000-11-19 09:06 UTC] stas@php.net
[2000-11-19 10:13 UTC] trifid at redigy dot cz
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 12:00:02 2025 UTC |
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] = '\0'; + path[0] = '\0'; return; } @@ -735,8 +734,7 @@ end--; } if (end < path) { - path[0] = DEFAULT_SLASH; - path[1] = '\0'; + path[0] = '\0'; return; } *(end+1) = '\0';