|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2011-07-28 11:20 UTC] laruence@php.net
-Type: Bug
+Type: Documentation Problem
[2011-07-28 11:20 UTC] laruence@php.net
[2011-07-28 11:25 UTC] mgf@php.net
-Status: Open
+Status: Assigned
-Assigned To:
+Assigned To: mgf
[2011-07-28 11:25 UTC] mgf@php.net
[2011-07-28 15:14 UTC] mgf@php.net
-Status: Assigned
+Status: Closed
[2011-07-28 15:14 UTC] mgf@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 12:00:01 2025 UTC |
Description: ------------ The options parameter of pathinfo() does not seem to operate according to the description in the manual, nor as might be expected. The manual description implies that if an options value consisting of more than one of the bitwise PATHINFO_* constants is supplied, the return value will be a string consisting of all the parts requested; however, this is not the case -- only the part corresponding to the lowest bit is returned. This seems both contrary to the documentation and completely illogical. It would be much better if pathinfo returned an array of the requested elements, *except* when a single element is requested. If this is deemed not possible due to BC, either the behaviour or the documentation should be fixed so that they match! Test script: --------------- <?php $info = pathinfo('/path/name/file.ext', PATHINFO_FILENAME+PATHINFO_EXTENSION); var_dump($info); ?> Expected result: ---------------- EITHER: array(2) { ["extension"]=> string(3) "ext" ["filename"]=> string(4) "file" } OR: string(8) "file.ext" Actual result: -------------- string(3) "ext"