Doc #81079 [Opn->Ver]: pathinfo() unexpected path/filename separation with trailing slash

From: Date: Tue, 25 May 2021 12:13:14 +0000
Subject: Doc #81079 [Opn->Ver]: pathinfo() unexpected path/filename separation with trailing slash
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-18805@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=81079&edit=1

 ID:                 81079
 Updated by:         cmb@php.net
 Reported by:        info at kgsw dot de
 Summary:            pathinfo() unexpected path/filename separation with
                     trailing slash
-Status:             Open
+Status:             Verified
 Type:               Documentation Problem
 Package:            *Directory/Filesystem functions
 Operating System:   Linux Mint 20.1
 PHP Version:        7.3.28
 Block user comment: N
 Private report:     N

 New Comment:

Well, that behavior might be confusing, but it is long
standing[1], and consistent with basedir() and dirname(), so it
can't be changed. A note in the docs won't hurt.

[1] <https://3v4l.org/aXYbl>
[2] <https://3v4l.org/mlkXI>


Previous Comments:
------------------------------------------------------------------------
[2021-05-24 14:57:13] info at kgsw dot de

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 this bug report at https://bugs.php.net/bug.php?id=81079&edit=1


Thread (5 messages)

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