php.net |  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
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 "/"

Patches

Pull Requests

 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Feb 19 03:01:28 2025 UTC