bjori           Sun May  6 14:01:27 2007 UTC

  Modified files:              (Branch: PHP_5_2)
    /php-src/main       php_ini.c 
    /php-src    NEWS 
  Log:
  MFH: Fixed PHP CLI to use the php.ini from the binary location
  
  
http://cvs.php.net/viewvc.cgi/php-src/main/php_ini.c?r1=1.136.2.4.2.8&r2=1.136.2.4.2.9&diff_format=u
Index: php-src/main/php_ini.c
diff -u php-src/main/php_ini.c:1.136.2.4.2.8 
php-src/main/php_ini.c:1.136.2.4.2.9
--- php-src/main/php_ini.c:1.136.2.4.2.8        Mon Apr 16 08:09:56 2007
+++ php-src/main/php_ini.c      Sun May  6 14:01:26 2007
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: php_ini.c,v 1.136.2.4.2.8 2007/04/16 08:09:56 dmitry Exp $ */
+/* $Id: php_ini.c,v 1.136.2.4.2.9 2007/05/06 14:01:26 bjori Exp $ */
 
 #include "php.h"
 #include "ext/standard/info.h"
@@ -353,7 +353,26 @@
 #else
                if (sapi_module.executable_location) {
                        binary_location = (char *)emalloc(PATH_MAX);
-                       if (!realpath(sapi_module.executable_location, 
binary_location)) {
+                       if (!strchr(sapi_module.executable_location, '/')) {
+                               char *path;
+                               int found = 0;
+
+                               if ((path = getenv("PATH")) != NULL) {
+                                       char *search_dir, 
search_path[MAXPATHLEN];
+
+                                       while ((search_dir = strsep(&path, 
":")) != NULL) {
+                                               snprintf(search_path, 
MAXPATHLEN, "%s/%s", search_dir, sapi_module.executable_location);
+                                               if (VCWD_REALPATH(search_path, 
binary_location) && !VCWD_ACCESS(binary_location, X_OK)) {
+                                                       found = 1;
+                                                       break;
+                                               }
+                                       }
+                               }
+                               if (!found) {
+                                       efree(binary_location);
+                                       binary_location = NULL;
+                               }
+                       } else if 
(!VCWD_REALPATH(sapi_module.executable_location, binary_location) || 
VCWD_ACCESS(binary_location, X_OK)) {
                                efree(binary_location);
                                binary_location = NULL;                  
                        }
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.682&r2=1.2027.2.547.2.683&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.682 php-src/NEWS:1.2027.2.547.2.683
--- php-src/NEWS:1.2027.2.547.2.682     Sat May  5 15:36:15 2007
+++ php-src/NEWS        Sun May  6 14:01:26 2007
@@ -4,6 +4,7 @@
 - Fixed ext/filter Email Validation Vulnerability (MOPB-24 by Stefan Esser)
   (Ilia)
 - Fixed altering $this via argument named "this". (Dmitry)
+- Fixed PHP CLI to use the php.ini from the binary location. (Hannes)
 - Fixed bug #41287 (Namespace functions don't allow xmlns defintion to be 
   optional). (Rob)
 - Fixed bug #41285 (Improved fix for CVE-2007-1887 to work with non-bundled

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to