php.net |  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
Votes:2
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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: russellbarnhart at gmail dot com
New email:
PHP Version: OS:

 

 [2014-04-09 12:51 UTC] russellbarnhart at gmail dot com
Description:
------------
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:
----------------
Array
(
    [dirname] => /some/path
    [basename] => .test
    [extension] =>
    [filename] => .test
)

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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

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"
respectively.

[1] <http://3v4l.org/hsDPm>
 [2016-06-22 14:16 UTC] cmb@php.net
-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] cmb@php.net
Automatic comment from SVN on behalf of cmb
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=339450
Log: Fix #67048: pathinfo() doesn't document parsing of dot-files
 [2016-06-22 14:18 UTC] cmb@php.net
-Status: Verified +Status: Closed
 [2016-06-22 14:18 UTC] cmb@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:07 UTC] phpdocbot@php.net
Automatic comment on behalf of cmb
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=3e831d6e6f935aa2518e31c459b25c14df8e553a
Log: Fix #67048: pathinfo() doesn't document parsing of dot-files
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 01:01:28 2024 UTC