com php-src: Fixed bug #66395 basename function doesn't remove drive letter: NEWS ext/standard/string.c ext/standard/tests/file/base
name_bug66395-win32.phpt

From: Date: Fri, 03 Jan 2014 21:25:58 +0000
Subject: com php-src: Fixed bug #66395 basename function doesn't remove drive letter: NEWS ext/standard/string.c ext/standard/tests/file/base
name_bug66395-win32.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-75530@lists.php.net to get a copy of this message
Commit: 46f60fae22b420320f3616e00928d70706cf4f4c Author: Anatol Belski <ab@php.net> Fri, 3 Jan 2014 22:25:58 +0100 Parents: c0d060f5c02db168f1de895b41afffbc6e3cacfb Branches: PHP-5.4 PHP-5.5 PHP-5.6 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=46f60fae22b420320f3616e00928d70706cf4f4c Log: Fixed bug #66395 basename function doesn't remove drive letter Bugs: https://bugs.php.net/66395 Changed paths: M NEWS M ext/standard/string.c A ext/standard/tests/file/basename_bug66395-win32.phpt Diff: diff --git a/NEWS b/NEWS index d842e12..b87803d 100644 --- a/NEWS +++ b/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) diff --git a/ext/standard/string.c b/ext/standard/string.c index b3860ad..bf2df9a 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -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 diff --git a/ext/standard/tests/file/basename_bug66395-win32.phpt b/ext/standard/tests/file/basename_bug66395-win32.phpt new file mode 100644 index 0000000..a9580dc --- /dev/null +++ b/ext/standard/tests/file/basename_bug66395-win32.phpt @@ -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==

« previous php.cvs (#75530) next »