summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorRui Hirokawa <hirokawa@php.net>2002-04-25 14:43:40 +0000
committerRui Hirokawa <hirokawa@php.net>2002-04-25 14:43:40 +0000
commit860e67588461bd93108ab48dd7d8459df6d96a5c (patch)
tree349e22e6510935e932e4b90de03fff49b9fee642 /ext
parent03a52cd97c20eb46a1d2383ab2d49c32be242e4e (diff)
downloadphp-git-860e67588461bd93108ab48dd7d8459df6d96a5c.tar.gz
fixed directory access problem when direcory name is encoded in japanese Shift_JIS encoding.
Diffstat (limited to 'ext')
-rw-r--r--ext/standard/string.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/ext/standard/string.c b/ext/standard/string.c
index f6bda9a231..fd409ee8ad 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -1051,7 +1051,7 @@ PHPAPI char *php_basename(char *s, size_t len, char *suffix, size_t sufflen)
/* strip trailing slashes */
while (*c == '/'
#ifdef PHP_WIN32
- || *c == '\\'
+ || (*c == '\\' && !IsDBCSLeadByte(*(c-1)))
#endif
)
c--;
@@ -1063,7 +1063,7 @@ PHPAPI char *php_basename(char *s, size_t len, char *suffix, size_t sufflen)
if ((c = strrchr(s, '/'))
#ifdef PHP_WIN32
- || (c = strrchr(s, '\\'))
+ || ((c = strrchr(s, '\\')) && !IsDBCSLeadByte(*(c-1)))
#endif
) {
ret = estrdup(c + 1);
@@ -1108,7 +1108,7 @@ PHPAPI void php_dirname(char *path, int len)
}
/* Strip trailing slashes */
- while (end >= path && IS_SLASH(*end)) {
+ while (end >= path && IS_SLASH_P(end)) {
end--;
}
if (end < path) {
@@ -1119,7 +1119,7 @@ PHPAPI void php_dirname(char *path, int len)
}
/* Strip filename */
- while (end >= path && !IS_SLASH(*end)) {
+ while (end >= path && !IS_SLASH_P(end)) {
end--;
}
if (end < path) {
@@ -1130,7 +1130,7 @@ PHPAPI void php_dirname(char *path, int len)
}
/* Strip slashes which came before the file name */
- while (end >= path && IS_SLASH(*end)) {
+ while (end >= path && IS_SLASH_P(end)) {
end--;
}
if (end < path) {