|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #67048 pathinfo() doesn't document parsing of dot-files
Submitted: 2014-04-09 12:51 UTC Modified: 2016-06-22 14:18 UTC
Avg. Score:3.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:2 (100.0%)
From: russellbarnhart at gmail dot com Assigned: cmb (profile)
Status: Closed Package: Filesystem function related
PHP Version: Irrelevant OS: *nix
Private report: No CVE-ID: None
 [2014-04-09 12:51 UTC] russellbarnhart at gmail dot com
The function pathinfo() assumes all files that have a basename starting with a period only have an extension.

This bug is present in at least 5.3.x to 5.5.x.

Test script:
# copy & paste into a shell
php -r "print_r(pathinfo('/some/path/.test'));"

Expected result:
    [dirname] => /some/path
    [basename] => .test
    [extension] =>
    [filename] => .test

Actual result:
    [dirname] => /some/path
    [basename] => .test
    [extension] => test
    [filename] => 


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2015-02-15 21:20 UTC] cmbecker69 at gmx dot de
pathinfo's behavior wrt. "hidden" files might be debatable (under
the assumption that extension is defined as everything after the
rightmost dot in the basename, it is not a bug).
However, the behavior is the same since PHP 4.3 at least[1], so
changing it would be a massive BC break. I suggest to improve the
documentation, and to change the issue to "Documentation problem"

[1] <>
 [2016-06-22 14:16 UTC]
-Summary: pathinfo() incorrectly parsing hidden file paths +Summary: pathinfo() doesn't document parsing of dot-files -Status: Open +Status: Verified -Type: Bug +Type: Documentation Problem -Assigned To: +Assigned To: cmb
 [2016-06-22 14:17 UTC]
Automatic comment from SVN on behalf of cmb
Log: Fix #67048: pathinfo() doesn't document parsing of dot-files
 [2016-06-22 14:18 UTC]
-Status: Verified +Status: Closed
 [2016-06-22 14:18 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:07 UTC]
Automatic comment on behalf of cmb
Log: Fix #67048: pathinfo() doesn't document parsing of dot-files
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sun Jun 04 19:03:41 2023 UTC