Doc #69263 [Opn->Nab]: dirname() removes only some double-slashes

From: Date: Thu, 19 Mar 2015 19:37:15 +0000
Subject: Doc #69263 [Opn->Nab]: dirname() removes only some double-slashes
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-12012@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=69263&edit=1 ID: 69263 Updated by: cmb@php.net Reported by: marc at gutt dot it Summary: dirname() removes only some double-slashes -Status: Open +Status: Not a bug Type: Documentation Problem Package: Directory function related Operating System: Debian PHP Version: 5.4.38 Block user comment: N Private report: N New Comment: Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php Note, that dirname() is supposed to work on paths, and is not necessarily suited for general URIs. Also note, that the double slashes in your examples are actually errors (except the double slashes after the colon following the protocol). Previous Comments: ------------------------------------------------------------------------ [2015-03-19 11:41:28] marc at gutt dot it Description: ------------ --- From manual page: http://www.php.net/function.dirname --- dirname() removes ending double slash, but does not replace double-slash generally. It think the ending "//" should become "/" as this is the parent. Test script: --------------- <?php echo dirname('http://example.com/foo/bar//index.php') . PHP_EOL; //returns: http://example.com/foo/bar echo dirname('http://example.com//foo//bar//index.php') . PHP_EOL; //returns: http://example.com//foo//bar ?> Expected result: ---------------- I would expect in both cases one ending slash: <?php echo dirname('http://example.com/foo/bar//index.php') . PHP_EOL; //returns: http://example.com/foo/bar/ echo dirname('http://example.com//foo//bar//index.php') . PHP_EOL; //returns: http://example.com//foo//bar/ ?> ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=69263&edit=1

« previous php.doc.bugs (#12012) next »