#45279 [WFx]: Results of dirname() on paths ending with a /

From: Date: Fri, 01 Aug 2008 17:17:24 +0000
Subject: #45279 [WFx]: Results of dirname() on paths ending with a /
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-127474@lists.php.net to get a copy of this message
ID: 45279 User updated by: ralph at deboom dot biz Reported By: ralph at deboom dot biz Status: Wont fix Bug Type: Directory function related Operating System: Debian Etch 4.0+ PHP Version: 5.2.6 Assigned To: dmitry New Comment: Then please do update the docs? Previous Comments: ------------------------------------------------------------------------ [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); } } ------------------------------------------------------------------------ [2008-06-20 08:37:37] pajoye@php.net It may be a BC break to change the behavior now so I would prefer to update the documentation instead. However, after having looked at the code, it seems to be a bug in the implementation (but the BC issue remains). Assigned to Dmitry (on request). ------------------------------------------------------------------------ [2008-06-20 08:04:16] ralph at deboom dot biz Where is the support on this bug...? ------------------------------------------------------------------------ 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

« previous php.bugs (#127474) next »