php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #51685 dirname() returns part of query string parsing a URL containing a slash
Submitted: 2010-04-28 19:37 UTC Modified: 2010-04-28 19:44 UTC
From: shepard dot dl at gmail dot com Assigned:
Status: Not a bug Package: Directory function related
PHP Version: 5.3.2 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
44 - 12 = ?
Subscribe to this entry?

 
 [2010-04-28 19:37 UTC] shepard dot dl at gmail dot com
Description:
------------
If a url that contains a slash (/) is passed to dirname(), dirname() returns 
everything up to the slash in the query string.

Test script:
---------------
$dirname = "web/index.php?url=pages/test.php";
print dirname($dirname);

Expected result:
----------------
application/pages

Actual result:
--------------
application/pages/index.php?url=pages

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-04-28 19:42 UTC] shepard dot dl at gmail dot com
I made a mistake in the description. It should read: "If a url with a query string 
that contains a slash (/) is passed to dirname(), dirname() returns everything up 
to the slash in the query string."
 [2010-04-28 19:44 UTC] pajoye@php.net
-Status: Open +Status: Bogus
 [2010-04-28 19:44 UTC] pajoye@php.net
Use parse_url if you like to parse URL.
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sat Oct 31 20:01:24 2020 UTC