|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #20895 dirname() behaviour changed
Submitted: 2002-12-08 23:35 UTC Modified: 2004-04-03 10:51 UTC
From: gambier dot olivier at free dot fr Assigned:
Status: Closed Package: Documentation problem
PHP Version: 4.3.0RC2 OS: Win 2000Pro SP3
Private report: No CVE-ID: None
 [2002-12-08 23:35 UTC] gambier dot olivier at free dot fr

Up to 4.2.3:

// or
// both returned   '.'

in 4.3.0 RC2, we got now:

// gives you   c:\
// gives you   c:

(i) I'm not sure that such path shall be used with dirname(). But after all, why not? And in fact I used it.
(ii) What's the reason for that behaviour change?
(iii) As some of my classes are now broken, will this new behaviour become the rule for the future?

Apache independent.
Standarts php.ini (recommended) and httpd.conf
Mozilla 1.2



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-12-08 23:56 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

 [2002-12-10 20:05 UTC]
A couple people just tested this and get the same results as the bug report with 4.3.0RC2, please explain why this behavior changed.
 [2002-12-11 11:16 UTC]
Suppose you have a file c:/file.txt and you want to open another file from the same directory.
If dirname("c:/file.txt"); return '.', then fopen ("./another_file.txt") will fail because it is looking in the wrong directory, the current current directory. If it returns c:/ or c: then c: + / + file will resolve to the actual file and open it correctly.
 [2002-12-18 18:13 UTC]
Okay, marking as a documentation bug.  A <note> needs to exist in the dirname docs for windows users as the current POSIX <note> isn't accurate as of PHP 4.3.0...
 [2003-01-02 20:34 UTC]
Okay since philip was around, I assign that to him.
 [2003-01-19 15:17 UTC]
Don't assign bugs to me.
 [2004-04-03 10:51 UTC]
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.

 [2020-02-07 06:12 UTC]
Automatic comment on behalf of nlopess
Log: fix #20895 dirname changed its behaviour
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Tue Aug 09 01:05:44 2022 UTC