php.net |  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
Hello.

Up to 4.2.3:


dirname("c:/");
// or
dirname("c:");
// both returned   '.'


in 4.3.0 RC2, we got now:


dirname("c:/");
// gives you   c:\
dirname("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

Thanks.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

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


 [2002-12-10 20:05 UTC] philip@php.net
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] iliaa@php.net
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] philip@php.net
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] nicos@php.net
Okay since philip was around, I assign that to him.
 [2003-01-19 15:17 UTC] philip@php.net
Don't assign bugs to me.
 [2004-04-03 10:51 UTC] nlopess@php.net
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] phpdocbot@php.net
Automatic comment on behalf of nlopess
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=df4645cc0ef239bf3321ee4ae2b1a255ba4fddb3
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