Doc #81079 [NEW]: pathinfo() unexpected path/filename separation with trailing slash

From: Date: Mon, 24 May 2021 14:57:13 +0000
Subject: Doc #81079 [NEW]: pathinfo() unexpected path/filename separation with trailing slash
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-18797@lists.php.net to get a copy of this message
From:             info at kgsw dot de
Operating system: Linux Mint 20.1
PHP version:      7.3.28
Package:          *Directory/Filesystem functions
Bug Type:         Documentation Problem
Bug description:pathinfo() unexpected path/filename separation with trailing slash

Description:
------------
using linux command line, sometimes trailing slash will make sure to
identify a directory; 

my own, manual functions would first split path from filename at the
_last_ slash;
 which would find NO filename, only path, in that example;

for me unexpected - so need documentation or is a bug? 

I could not find PHP 7.4.3 in the options dropbox to select using:
PHP 7.4.3 (cli) (built: Oct  6 2020 15:47:56) ( NTS )

once reported on Win2k - but discarded as "no URL function" - but I
think, this is not the point - it is just unexpected
https://bugs.php.net/bug.php?id=41834

If you still insist on that IMHO strange behaviour, I would like to add
a note to the manual

Test script:
---------------
php > var_dump( pathinfo('/home/user/backup.2021-05-24/'));
array(4) {
  ["dirname"]=>
  string(10) "/home/user"
  ["basename"]=>
  string(17) "backup.2021-05-24"
  ["extension"]=>
  string(10) "2021-05-24"
  ["filename"]=>
  string(6) "backup"
}

Expected result:
----------------
array(4) {
  ["dirname"]=>
  string(10) "/home/user/backup.2021-05-24"
  // no more set - cause no filename given
}


-- 
Edit bug report at https://bugs.php.net/bug.php?id=81079&edit=1
-- 
Fix committed:                    https://bugs.php.net/fix.php?id=81079&r=fixed
Fixed in release:                 https://bugs.php.net/fix.php?id=81079&r=alreadyfixed
Need backtrace:                   https://bugs.php.net/fix.php?id=81079&r=needtrace
Need Reproduce Script:            https://bugs.php.net/fix.php?id=81079&r=needscript
Try newer version:                https://bugs.php.net/fix.php?id=81079&r=oldversion
Not developer issue:              https://bugs.php.net/fix.php?id=81079&r=support
Expected behavior:                https://bugs.php.net/fix.php?id=81079&r=notwrong
Not enough info:                  https://bugs.php.net/fix.php?id=81079&r=notenoughinfo
Submitted twice:                  https://bugs.php.net/fix.php?id=81079&r=submittedtwice
register_globals:                 https://bugs.php.net/fix.php?id=81079&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=81079&r=phptooold
Daylight Savings:                 https://bugs.php.net/fix.php?id=81079&r=dst
IIS Stability:                    https://bugs.php.net/fix.php?id=81079&r=isapi
Install GNU Sed:                  https://bugs.php.net/fix.php?id=81079&r=gnused
Floating point limitations:       https://bugs.php.net/fix.php?id=81079&r=float
No Zend Extensions:               https://bugs.php.net/fix.php?id=81079&r=nozend
MySQL Configuration Error:        https://bugs.php.net/fix.php?id=81079&r=mysqlcfg


Thread (5 messages)

« previous php.doc.bugs (#18797) next »