PHP 4.0 Bug #9406: if you don't have PHPRC set, php will try to load /php.ini
| From: | hps at intermeta dot de | Date: | Thu, 22 Feb 2001 17:00:13 +0000 |
| Subject: | PHP 4.0 Bug #9406: if you don't have PHPRC set, php will try to load /php.ini | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-47265@lists.php.net to get a copy of this message | ||
From: hps@intermeta.de
Operating system: all OS
PHP version: 4.0.4pl1
PHP Bug Type: *Configuration Issues
Bug description: if you don't have PHPRC set, php will try to load /php.ini
PHP tries to load a config file called "/php.ini" if you don't set the
PHPRC environment variable. This is due to a bad path composition
in php_ini.c
The environment definition is left empty and later, there is a "/php.ini"
tacked on unconditionally. This may lead to undesired behaviour if root
has its home not in /root but in / (as with some older OS).
Patch attached.
--- php-4.0.4pl1/main/php_ini.c.orig Thu Feb 22 17:55:44 2001
+++ php-4.0.4pl1/main/php_ini.c Thu Feb 22 17:56:28 2001
@@ -191,10 +191,14 @@
if (!php_ini_path) {
#ifdef PHP_WIN32
-
sprintf(php_ini_search_path,".;%s;%s",env_location,default_location);
+ const char delim = ';';
#else
-
sprintf(php_ini_search_path,".:%s:%s",env_location,default_location);
+ const char delim = ':';
#endif
+ if(*env_location)
+ sprintf(php_ini_search_path,".%c%s%c%s",delim, env_location,delim,
default_location);
+ else
+ sprintf(php_ini_search_path,".%c%s",delim, default_location);
} else {
/* if path was set via -c flag, only look there */
strcpy(php_ini_search_path,default_location);
--
Edit Bug report at: http://bugs.php.net/?id=9406&edit=1