summaryrefslogtreecommitdiff
path: root/main/php_ini.c
diff options
context:
space:
mode:
authorPierre Joye <pajoye@php.net>2009-10-11 20:50:53 +0000
committerPierre Joye <pajoye@php.net>2009-10-11 20:50:53 +0000
commit4d63bd1132fa483e381b67659c63eb3a72e467d6 (patch)
treee40a99897f5bebbaf65dc4f590ebf8626fd58687 /main/php_ini.c
parent895215589867fd4cba4f6bb9becffe051702427e (diff)
downloadphp-git-4d63bd1132fa483e381b67659c63eb3a72e467d6.tar.gz
- #48779, don't loop twice over the path chars
Diffstat (limited to 'main/php_ini.c')
-rw-r--r--main/php_ini.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/main/php_ini.c b/main/php_ini.c
index 0b31ad5c42..12bb268b83 100644
--- a/main/php_ini.c
+++ b/main/php_ini.c
@@ -42,16 +42,17 @@
#endif
#ifdef PHP_WIN32
-#define TRANSLATE_SLASHES(path) \
+#define TRANSLATE_SLASHES_LOWER(path) \
{ \
char *tmp = path; \
while (*tmp) { \
if (*tmp == '\\') *tmp = '/'; \
- tmp++; \
+ else *tmp = (__isascii(*tmp)) ? _tolower(*tmp) : tolower(*tmp); \
+ tmp++; \
} \
}
#else
-#define TRANSLATE_SLASHES(path)
+#define TRANSLATE_SLASHES_LOWER(path)
#endif
@@ -287,12 +288,9 @@ static void php_ini_parser_cb(zval *arg1, zval *arg2, zval *arg3, int callback_t
key_len = Z_STRLEN_P(arg1) - sizeof("PATH") + 1;
is_special_section = 1;
has_per_dir_config = 1;
-#ifdef PHP_WIN32
- /* make the path lowercase on Windows, for case insensitivty. */
- strlwr(key);
- TRANSLATE_SLASHES(key);
-#endif
+ /* make the path lowercase on Windows, for case insensitivty. Does nothign for other platforms */
+ TRANSLATE_SLASHES_LOWER(key);
/* HOST sections */
} else if (!strncasecmp(Z_STRVAL_P(arg1), "HOST", sizeof("HOST") - 1)) {