1
0
mirror of https://github.com/php/php-src.git synced 2026-04-25 08:58:28 +02:00
Files
archived-php-src/ext/standard/tests/strings/basename_invalid_path.phpt
T
Nikita Popov 90705d44e3 Treat invalid characters in basename() consistently
Always simply ignore (pass through) them. Previously the behavior
depended on where the invalid character occurred, as it messed
up the state management.
2020-04-29 18:43:09 +02:00

25 lines
617 B
PHP

--TEST--
Test basename() function : usage variations with invalid paths
--SKIPIF--
<?php
if((substr(PHP_OS, 0, 3) == "WIN"))
die('skip not for Windows"');
?>
--FILE--
<?php
/* Prototype: string basename ( string $path [, string $suffix] );
Description: Given a string containing a path to a file,
this function will return the base name of the file.
If the filename ends in suffix this will also be cut off.
*/
setlocale(LC_CTYPE, "C");
var_dump(bin2hex(basename("\xff")));
var_dump(bin2hex(basename("a\xffb")));
echo "Done\n";
--EXPECT--
string(2) "ff"
string(6) "61ff62"
Done