iliaa Sun Jun 29 11:36:11 2003 EDT
Modified files: (Branch: PHP_4_3)
/php-src/ext/standard string.c
Log:
Fixed bug #24340 (basename failure win32 with containing both \ and /)
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.333.2.31
php-src/ext/standard/string.c:1.333.2.32
--- php-src/ext/standard/string.c:1.333.2.31 Fri Jun 20 11:44:48 2003
+++ php-src/ext/standard/string.c Sun Jun 29 11:36:10 2003
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: string.c,v 1.333.2.31 2003/06/20 15:44:48 pollita Exp $ */
+/* $Id: string.c,v 1.333.2.32 2003/06/29 15:36:10 iliaa Exp $ */
/* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
@@ -1102,11 +1102,17 @@
p = c + 1; /* Save pointer to overwritten char */
}
- if ((c = strrchr(s, '/'))
#ifdef PHP_WIN32
- || ((c = strrchr(s, '\\')) && !IsDBCSLeadByte(*(c-1)))
+ if ((c = strrchr(s, '/')) || ((c = strrchr(s, '\\')) &&
!IsDBCSLeadByte(*(c-1)))) {
+ if (*c == '/') {
+ char *c2 = strrchr(s, '\\');
+ if (c2 && !IsDBCSLeadByte(*(c2-1)) && c2 > c) {
+ c = c2;
+ }
+ }
+#else
+ if ((c = strrchr(s, '/'))) {
#endif
- ) {
ret = estrdup(c + 1);
} else {
ret = estrdup(s);
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php