Bug #80155 [Opn->Ver]: basename("/tmp","tmp") fails
| From: | sjon@php.net | Date: | Sun, 27 Sep 2020 12:43:35 +0000 |
| Subject: | Bug #80155 [Opn->Ver]: basename("/tmp","tmp") fails | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-229233@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=80155&edit=1
ID: 80155
Updated by: sjon@php.net
Reported by: divinity76 at gmail dot com
Summary: basename("/tmp","tmp") fails
-Status: Open
+Status: Verified
Type: Bug
Package: *Directory/Filesystem functions
Operating System: both Windows and Linux
PHP Version: 7.4.10
Block user comment: N
Private report: N
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
while unexpected - this behavior matches what GNU's basename returns, see:
$ basename /tmp mp
t
$ basename /tmp tmp
tmp
I assume this is because once the entire pathname is removed, it would no longer be a suffix
Previous Comments:
------------------------------------------------------------------------
[2020-09-27 11:43:38] divinity76 at gmail dot com
Description:
------------
running basename("/tmp","tmp") fails to remove the "tmp" suffix from
the end of the name.
tested on PHP 8.0.0 beta3 running on Linux, and PHP 7.3.7 running on Windows 10.
Test script:
---------------
<?php
var_dump(basename("/tmp","mp"));
var_dump(basename("/tmp","tmp"));
Expected result:
----------------
string(1) "t"
string(0) ""
Actual result:
--------------
string(1) "t"
string(3) "tmp"
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=80155&edit=1