svn: /php/php-src/ branches/PHP_5_3/main/php_ini.c trunk/main/php_ini.c
| From: | Pierre-Alain Joye | Date: | Sun, 11 Oct 2009 20:50:53 +0000 |
| Subject: | svn: /php/php-src/ branches/PHP_5_3/main/php_ini.c trunk/main/php_ini.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-60656@lists.php.net to get a copy of this message | ||
pajoye Sun, 11 Oct 2009 20:50:53 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=289546
Log:
- #48779, don't loop twice over the path chars
Bug: http://bugs.php.net/48779 (Open) Use of HOST section
cause 500 error
Changed paths:
U php/php-src/branches/PHP_5_3/main/php_ini.c
U php/php-src/trunk/main/php_ini.c
Modified: php/php-src/branches/PHP_5_3/main/php_ini.c
===================================================================
--- php/php-src/branches/PHP_5_3/main/php_ini.c 2009-10-11 20:14:47 UTC (rev 289545)
+++ php/php-src/branches/PHP_5_3/main/php_ini.c 2009-10-11 20:50:53 UTC (rev 289546)
@@ -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 @@
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)) {
Modified: php/php-src/trunk/main/php_ini.c
===================================================================
--- php/php-src/trunk/main/php_ini.c 2009-10-11 20:14:47 UTC (rev 289545)
+++ php/php-src/trunk/main/php_ini.c 2009-10-11 20:50:53 UTC (rev 289546)
@@ -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 @@
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)) {