Bug #67048 [Com]: pathinfo() incorrectly parsing hidden file paths

From: Date: Sun, 15 Feb 2015 21:20:38 +0000
Subject: Bug #67048 [Com]: pathinfo() incorrectly parsing hidden file paths
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-190706@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=67048&edit=1 ID: 67048 Comment by: cmbecker69 at gmx dot de Reported by: russellbarnhart at gmail dot com Summary: pathinfo() incorrectly parsing hidden file paths Status: Open Type: Bug Package: Filesystem function related Operating System: *nix PHP Version: Irrelevant Block user comment: N Private report: N New Comment: 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> Previous Comments: ------------------------------------------------------------------------ [2014-04-09 12:51:22] 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] => ) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=67048&edit=1

« previous php.bugs (#190706) next »