|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #18710 dirname("/") returns ("\")
Submitted: 2002-08-02 14:18 UTC Modified: 2002-10-31 18:53 UTC
From: duncan at emarketeers dot com Assigned:
Status: Closed Package: *Directory/Filesystem functions
PHP Version: 4.2.2 OS: Windows 2000
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.
Block user comment
Status: Assign to:
Bug Type:
From: duncan at emarketeers dot com
New email:
PHP Version: OS:


 [2002-08-02 14:18 UTC] duncan at emarketeers dot com
dirname() in windows works inconsistently.

dirname("/a/b") returns "/a"

but dirname("/") returns "\"

This makes writing portable code which will work on Unix and Windows problematic.

I've looked at ext/standard/string.c and I think the fix would be to replace all occurrences of DEFAULT_SLASH with "/"


Add a Patch

Pull Requests

Add a Pull Request

PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Fri Sep 30 00:03:42 2022 UTC