php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #9406 if you don't have PHPRC set, php will try to load /php.ini
Submitted: 2001-02-22 12:00 UTC Modified: 2001-03-06 06:41 UTC
From: hps at intermeta dot de Assigned:
Status: Closed Package: *Configuration Issues
PHP Version: 4.0.4pl1 OS: all OS
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: hps at intermeta dot de
New email:
PHP Version: OS:

 

 [2001-02-22 12:00 UTC] hps at intermeta dot de
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);


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-03-06 06:41 UTC] stas@php.net
fixed in CVS.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 06:01:30 2024 UTC