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
 [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-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 00:01:30 2024 UTC