mirror of
https://github.com/php/php-src.git
synced 2024-09-22 02:17:32 +00:00
Fixed bug #66395 basename function doesn't remove drive letter
This commit is contained in:
parent
c0d060f5c0
commit
46f60fae22
1
NEWS
1
NEWS
@ -103,6 +103,7 @@ PHP NEWS
|
||||
- Standard:
|
||||
. Fixed bug #64760 (var_export() does not use full precision for floating-point
|
||||
numbers) (Yasuo)
|
||||
. Fixed bug #66395 (basename function doesn't remove drive letter). (Anatol)
|
||||
|
||||
- XMLReader:
|
||||
. Fixed bug #51936 (Crash with clone XMLReader). (Mike)
|
||||
|
@ -1433,7 +1433,7 @@ PHPAPI void php_basename(const char *s, size_t len, char *suffix, size_t sufflen
|
||||
goto quit_loop;
|
||||
case 1:
|
||||
#if defined(PHP_WIN32) || defined(NETWARE)
|
||||
if (*c == '/' || *c == '\\') {
|
||||
if (*c == '/' || *c == '\\' || (*c == ':' && (c - s == 1))) {
|
||||
#else
|
||||
if (*c == '/') {
|
||||
#endif
|
||||
|
18
ext/standard/tests/file/basename_bug66395-win32.phpt
Normal file
18
ext/standard/tests/file/basename_bug66395-win32.phpt
Normal file
@ -0,0 +1,18 @@
|
||||
--TEST--
|
||||
basename bug #66395
|
||||
--SKIPIF--
|
||||
<?php if (substr(PHP_OS, 0, 3) != 'WIN') { die('skip Windows only basename tests'); } ?>
|
||||
--FILE--
|
||||
<?php
|
||||
echo basename("c:file.txt") . "\n";
|
||||
echo basename("d:subdir\\file.txt") . "\n";
|
||||
echo basename("y:file.txt", ".txt") . "\n";
|
||||
echo basename("notdriveletter:file.txt") . "\n";
|
||||
?>
|
||||
==DONE==
|
||||
--EXPECTF--
|
||||
file.txt
|
||||
file.txt
|
||||
file
|
||||
notdriveletter:file.txt
|
||||
==DONE==
|
Loading…
Reference in New Issue
Block a user