|  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
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:
Solve the problem:
19 - 2 = ?
Subscribe to this entry?

 [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: Thu Sep 29 23:05:55 2022 UTC