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
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: shepard dot dl at gmail dot com
New email:
PHP Version: OS:

 

 [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: Tue Sep 29 01:01:25 2020 UTC