diff --git a/ext/mysqlnd/mysqlnd_debug.c b/ext/mysqlnd/mysqlnd_debug.c index 80765f36131c1..44d02eda493e9 100644 --- a/ext/mysqlnd/mysqlnd_debug.c +++ b/ext/mysqlnd/mysqlnd_debug.c @@ -511,7 +511,7 @@ MYSQLND_METHOD(mysqlnd_debug, set_mode)(MYSQLND_DEBUG * self, const char * const if (i + 1 < mode_len && mode[i+1] == ',') { unsigned int j = i + 2; #ifdef PHP_WIN32 - if (i+4 < mode_len && mode[i+3] == ':' && (mode[i+4] == '\\' || mode[i+4] == '/')) { + if (i+4 < mode_len && mode[i+3] == ':' && IS_SLASH(mode[i+4])) { j = i + 5; } #endif diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c index 0af02748407a2..f3e65f8545fd8 100644 --- a/ext/phar/phar_object.c +++ b/ext/phar/phar_object.c @@ -1530,7 +1530,7 @@ static int phar_build(zend_object_iterator *iter, void *puser) /* {{{ */ str_key = fname + base_len; - if (*str_key == '/' || *str_key == '\\') { + if (IS_SLASH(*str_key)) { str_key++; str_key_len--; } diff --git a/ext/standard/string.c b/ext/standard/string.c index ef9e66ab53f8d..fd0440b101fd0 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -1342,11 +1342,10 @@ PHP_FUNCTION(str_decrement) static bool _is_basename_start(const char *start, const char *pos) { if (pos - start >= 1 - && *(pos-1) != '/' - && *(pos-1) != '\\') { + && !IS_SLASH(*(pos-1))) { if (pos - start == 1) { return true; - } else if (*(pos-2) == '/' || *(pos-2) == '\\') { + } else if (IS_SLASH(*(pos-2))) { return true; } else if (*(pos-2) == ':' && _is_basename_start(start, pos - 2)) { @@ -1369,8 +1368,7 @@ PHPAPI zend_string *php_basename(const char *s, size_t len, const char *suffix, /* Strip trailing slashes */ while (basename_end >= s #ifdef PHP_WIN32 - && (*basename_end == '/' - || *basename_end == '\\' + && (IS_SLASH(*basename_end) || (*basename_end == ':' && _is_basename_start(s, basename_end)))) { #else @@ -1387,8 +1385,7 @@ PHPAPI zend_string *php_basename(const char *s, size_t len, const char *suffix, basename_end++; while (basename_start > s #ifdef PHP_WIN32 - && *(basename_start-1) != '/' - && *(basename_start-1) != '\\') { + && !IS_SLASH(*(basename_start-1))) { if (*(basename_start-1) == ':' && _is_basename_start(s, basename_start - 1)) { @@ -1414,7 +1411,7 @@ PHPAPI zend_string *php_basename(const char *s, size_t len, const char *suffix, goto quit_loop; case 1: #ifdef PHP_WIN32 - if (*s == '/' || *s == '\\') { + if (IS_SLASH(*s)) { #else if (*s == '/') { #endif diff --git a/main/php_ini.c b/main/php_ini.c index 9925eafad1fdf..f99606a1b17e1 100644 --- a/main/php_ini.c +++ b/main/php_ini.c @@ -274,7 +274,7 @@ static void php_ini_parser_cb(zval *arg1, zval *arg2, zval *arg3, int callback_t if (key && key_len > 0) { /* Strip any trailing slashes */ - while (key_len > 0 && (key[key_len - 1] == '/' || key[key_len - 1] == '\\')) { + while (key_len > 0 && IS_SLASH(key[key_len - 1])) { key_len--; key[key_len] = 0; }