Merge branch 'PHP-5.6'

* PHP-5.6:
  Fixed bug #66395 basename function doesn't remove drive letter
This commit is contained in:
Anatol Belski 2014-01-03 22:39:17 +01:00
commit b502c0a3dc
2 changed files with 19 additions and 1 deletions

View File

@ -1429,7 +1429,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

View 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==