Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ext/mysqlnd/mysqlnd_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion ext/phar/phar_object.c
Original file line number Diff line number Diff line change
Expand Up @@ -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--;
}
Expand Down
13 changes: 5 additions & 8 deletions ext/standard/string.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand All @@ -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
Expand All @@ -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)) {
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion main/php_ini.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Loading