From: klaussantana at gmail dot com
Operating system: Any
PHP version: Irrelevant
Package: Filesystem function related
Bug Type: Feature/Change Request
Bug description:Mixing the $suffix parameter from basename()
Description:
------------
New functionalities for basename().
Syntax:
basename( mixed $path[, mixed $suffix = null[, bool $case_sensitive =
false]] );
Summary:
basename() will return the base name of the last component of the path. If
it is
a file name the function will return the name of the file. If it is a
directory
the function will return the name of the directory.
The $path parameter accepts a string or an array of strings to extract the
base
name of the last component of the path.
The $suffix parameter accepts a string or an array of strings to be
compared
against each $path value.
The $case_sensitive parameter accepts a boolean value (true or false) that
indicates if the $path and $suffix must be compared using "case sensitive"
or
"case insensitive" comparison method.
Return value:
A single string or an array of strings with the base name of the last
component
of the corresponding string stripping $suffix from it.
NOTE:
By default, the function will use "case insensitive" comparison method.
Test script:
---------------
$Files = array();
$Files[] = 'path/to/images/my-computer.jpg';
$Files[] = 'path/to/images/My-Dog.Jpeg';
$Files[] = 'path/to/images/loading.gif';
$Files[] = 'path/to/images/sketch.bmp';
// Overwriting the array
$Files = basename( $Files, array('.bmp', '.jpg', '.jpeg', '.gif', '.png')
);
print_r($Files);
Expected result:
----------------
Array
(
[0] => my-computer
[1] => My-Dog
[2] => loading
[3] => sketch
)
Actual result:
--------------
null
--
Edit bug report at https://bugs.php.net/bug.php?id=63279&edit=1
--
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=63279&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=63279&r=trysnapshot53
Try a snapshot (trunk):
https://bugs.php.net/fix.php?id=63279&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=63279&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=63279&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=63279&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=63279&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=63279&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=63279&r=support
Expected behavior: https://bugs.php.net/fix.php?id=63279&r=notwrong
Not enough info:
https://bugs.php.net/fix.php?id=63279&r=notenoughinfo
Submitted twice:
https://bugs.php.net/fix.php?id=63279&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=63279&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=63279&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=63279&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=63279&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=63279&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=63279&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=63279&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=63279&r=mysqlcfg