From: Operating system: PHP version: 5.3.6 Package: *Directory/Filesystem functions Bug Type: Bug Bug description:pathinfo() options parameter not as expected
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" -- Edit bug report at https://bugs.php.net/bug.php?id=55308&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=55308&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=55308&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=55308&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=55308&r=fixed Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=55308&r=needdocs Fixed in release: https://bugs.php.net/fix.php?id=55308&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=55308&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=55308&r=needscript Try newer version: https://bugs.php.net/fix.php?id=55308&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=55308&r=support Expected behavior: https://bugs.php.net/fix.php?id=55308&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=55308&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=55308&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=55308&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=55308&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=55308&r=dst IIS Stability: https://bugs.php.net/fix.php?id=55308&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=55308&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=55308&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=55308&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=55308&r=mysqlcfg