garretts Fri, 09 Oct 2009 19:43:00 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=289445
Log:
- changed ini file directives [PATH=](on Win32) and [HOST=](on all) to be case
insensitive (garretts)
Changed paths:
U php/php-src/branches/PHP_5_3/NEWS
U php/php-src/branches/PHP_5_3/main/php_ini.c
U php/php-src/branches/PHP_5_3/sapi/cgi/cgi_main.c
U php/php-src/trunk/main/php_ini.c
U php/php-src/trunk/sapi/cgi/cgi_main.c
Modified: php/php-src/branches/PHP_5_3/NEWS
===================================================================
--- php/php-src/branches/PHP_5_3/NEWS 2009-10-09 19:13:33 UTC (rev 289444)
+++ php/php-src/branches/PHP_5_3/NEWS 2009-10-09 19:43:00 UTC (rev 289445)
@@ -1,6 +1,8 @@
PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? 20??, PHP 5.3.2
+- changed ini file directives [PATH=](on Win32) and [HOST=](on all) to be case
+ insensitive (garretts)
- Added ReflectionMethod::setAccessible() for invoking non-public methods
through the Reflection API. (Sebastian)
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-09 19:13:33 UTC (rev
289444)
+++ php/php-src/branches/PHP_5_3/main/php_ini.c 2009-10-09 19:43:00 UTC (rev
289445)
@@ -41,6 +41,20 @@
#define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
#endif
+#ifdef PHP_WIN32
+#define TRANSLATE_SLASHES(path) \
+ { \
+ char *tmp = path; \
+ while (*tmp) { \
+ if (*tmp == '\\') *tmp = '/'; \
+ tmp++; \
+ } \
+ }
+#else
+#define TRANSLATE_SLASHES(path)
+#endif
+
+
typedef struct _php_extension_lists {
zend_llist engine;
zend_llist functions;
@@ -273,7 +287,13 @@
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
+
/* HOST sections */
} else if (!strncasecmp(Z_STRVAL_P(arg1),
"HOST", sizeof("HOST") - 1)) {
key = Z_STRVAL_P(arg1);
@@ -281,6 +301,7 @@
key_len = Z_STRLEN_P(arg1) -
sizeof("HOST") + 1;
is_special_section = 1;
has_per_host_config = 1;
+ strlwr(key); // host names are
case-insensitive.
} else {
is_special_section = 0;
Modified: php/php-src/branches/PHP_5_3/sapi/cgi/cgi_main.c
===================================================================
--- php/php-src/branches/PHP_5_3/sapi/cgi/cgi_main.c 2009-10-09 19:13:33 UTC
(rev 289444)
+++ php/php-src/branches/PHP_5_3/sapi/cgi/cgi_main.c 2009-10-09 19:43:00 UTC
(rev 289445)
@@ -754,7 +754,11 @@
if it is inside the docroot, we scan the tree up to the
docroot
to find more user.ini, if not we only scan the current
path.
*/
+#ifdef PHP_WIN32
+ if (strnicmp(s1, s2, s_len) == 0) {
+#else
if (strncmp(s1, s2, s_len) == 0) {
+#endif
ptr = s2 + start; /* start is the point where doc_root
ends! */
while ((ptr = strchr(ptr, DEFAULT_SLASH)) != NULL) {
*ptr = 0;
@@ -777,7 +781,7 @@
static int sapi_cgi_activate(TSRMLS_D)
{
char *path, *doc_root, *server_name;
- uint path_len, doc_root_len;
+ uint path_len, doc_root_len, server_name_len;
/* PATH_TRANSLATED should be defined at this stage but better safe than
sorry :) */
if (!SG(request_info).path_translated) {
@@ -789,7 +793,11 @@
server_name = sapi_cgibin_getenv("SERVER_NAME",
sizeof("SERVER_NAME") - 1 TSRMLS_CC);
/* SERVER_NAME should also be defined at this stage..but better
check it anyway */
if (server_name) {
- php_ini_activate_per_host_config(server_name,
strlen(server_name) + 1 TSRMLS_CC);
+ server_name_len = strlen(server_name);
+ server_name = estrndup(server_name, strlen(server_name)
);
+ strlwr(server_name);
+ php_ini_activate_per_host_config(server_name,
server_name_len + 1 TSRMLS_CC);
+ efree(server_name);
}
}
@@ -810,6 +818,10 @@
path_len = zend_dirname(path, path_len);
}
path[path_len] = 0;
+#ifdef PHP_WIN32
+ // paths on windows should be case-insensitive
+ strlwr(path);
+#endif
/* Activate per-dir-system-configuration defined in php.ini and
stored into configuration_hash during startup */
php_ini_activate_per_dir_config(path, path_len TSRMLS_CC); /*
Note: for global settings sake we check from root to path */
@@ -823,10 +835,18 @@
if (IS_SLASH(doc_root[doc_root_len - 1])) {
--doc_root_len;
}
+#ifdef PHP_WIN32
+ // paths on windows should be case-insensitive
+ doc_root = estrndup(doc_root, doc_root_len);
+ strlwr(doc_root);
+#endif
php_cgi_ini_activate_user_config(path,
path_len, doc_root, doc_root_len, doc_root_len - 1 TSRMLS_CC);
}
}
+#ifdef PHP_WIN32
+ efree(doc_root);
+#endif
efree(path);
}
Modified: php/php-src/trunk/main/php_ini.c
===================================================================
--- php/php-src/trunk/main/php_ini.c 2009-10-09 19:13:33 UTC (rev 289444)
+++ php/php-src/trunk/main/php_ini.c 2009-10-09 19:43:00 UTC (rev 289445)
@@ -41,6 +41,20 @@
#define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
#endif
+#ifdef PHP_WIN32
+#define TRANSLATE_SLASHES(path) \
+ { \
+ char *tmp = path; \
+ while (*tmp) { \
+ if (*tmp == '\\') *tmp = '/'; \
+ tmp++; \
+ } \
+ }
+#else
+#define TRANSLATE_SLASHES(path)
+#endif
+
+
typedef struct _php_extension_lists {
zend_llist engine;
zend_llist functions;
@@ -273,7 +287,13 @@
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
+
/* HOST sections */
} else if (!strncasecmp(Z_STRVAL_P(arg1),
"HOST", sizeof("HOST") - 1)) {
key = Z_STRVAL_P(arg1);
@@ -281,6 +301,7 @@
key_len = Z_STRLEN_P(arg1) -
sizeof("HOST") + 1;
is_special_section = 1;
has_per_host_config = 1;
+ strlwr(key); // host names are
case-insensitive.
} else {
is_special_section = 0;
Modified: php/php-src/trunk/sapi/cgi/cgi_main.c
===================================================================
--- php/php-src/trunk/sapi/cgi/cgi_main.c 2009-10-09 19:13:33 UTC (rev
289444)
+++ php/php-src/trunk/sapi/cgi/cgi_main.c 2009-10-09 19:43:00 UTC (rev
289445)
@@ -751,7 +751,11 @@
if it is inside the docroot, we scan the tree up to the
docroot
to find more user.ini, if not we only scan the current
path.
*/
+#ifdef PHP_WIN32
+ if (strnicmp(s1, s2, s_len) == 0) {
+#else
if (strncmp(s1, s2, s_len) == 0) {
+#endif
ptr = s2 + start; /* start is the point where doc_root
ends! */
while ((ptr = strchr(ptr, DEFAULT_SLASH)) != NULL) {
*ptr = 0;
@@ -774,7 +778,7 @@
static int sapi_cgi_activate(TSRMLS_D)
{
char *path, *doc_root, *server_name;
- uint path_len, doc_root_len;
+ uint path_len, doc_root_len, server_name_len;
/* PATH_TRANSLATED should be defined at this stage but better safe than
sorry :) */
if (!SG(request_info).path_translated) {
@@ -786,7 +790,11 @@
server_name = sapi_cgibin_getenv("SERVER_NAME",
sizeof("SERVER_NAME") - 1 TSRMLS_CC);
/* SERVER_NAME should also be defined at this stage..but better
check it anyway */
if (server_name) {
- php_ini_activate_per_host_config(server_name,
strlen(server_name) + 1 TSRMLS_CC);
+ server_name_len = strlen(server_name);
+ server_name = estrndup(server_name, strlen(server_name)
);
+ strlwr(server_name);
+ php_ini_activate_per_host_config(server_name,
server_name_len + 1 TSRMLS_CC);
+ efree(server_name);
}
}
@@ -807,6 +815,10 @@
path_len = zend_dirname(path, path_len);
}
path[path_len] = 0;
+#ifdef PHP_WIN32
+ // paths on windows should be case-insensitive
+ strlwr(path);
+#endif
/* Activate per-dir-system-configuration defined in php.ini and
stored into configuration_hash during startup */
php_ini_activate_per_dir_config(path, path_len TSRMLS_CC); /*
Note: for global settings sake we check from root to path */
@@ -820,10 +832,18 @@
if (IS_SLASH(doc_root[doc_root_len - 1])) {
--doc_root_len;
}
+#ifdef PHP_WIN32
+ // paths on windows should be case-insensitive
+ doc_root = estrndup(doc_root, doc_root_len);
+ strlwr(doc_root);
+#endif
php_cgi_ini_activate_user_config(path,
path_len, doc_root, doc_root_len, doc_root_len - 1 TSRMLS_CC);
}
}
+#ifdef PHP_WIN32
+ efree(doc_root);
+#endif
efree(path);
}
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php