logo       
Google Custom Search
    AddThis Social Bookmark Button

cvs: pear-core /PEAR Config.php: msg#00087

Subject: cvs: pear-core /PEAR Config.php
cellog          Sun Mar 26 23:24:50 2006 UTC

  Modified files:              
    /pear-core/PEAR     Config.php 
  Log:
  remove as many @ as possible from PEAR_Config
  
http://cvs.php.net/viewcvs.cgi/pear-core/PEAR/Config.php?r1=1.125&r2=1.126&diff_format=u
Index: pear-core/PEAR/Config.php
diff -u pear-core/PEAR/Config.php:1.125 pear-core/PEAR/Config.php:1.126
--- pear-core/PEAR/Config.php:1.125     Sat Mar 25 21:09:08 2006
+++ pear-core/PEAR/Config.php   Sun Mar 26 23:24:50 2006
@@ -16,7 +16,7 @@
  * @author     Greg Beaver <cellog@xxxxxxx>
  * @copyright  1997-2006 The PHP Group
  * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    CVS: $Id: Config.php,v 1.125 2006/03/25 21:09:08 cellog Exp $
+ * @version    CVS: $Id: Config.php,v 1.126 2006/03/26 23:24:50 cellog Exp $
  * @link       http://pear.php.net/package/PEAR
  * @since      File available since Release 0.1
  */
@@ -84,7 +84,7 @@
 if (getenv('PHP_PEAR_INSTALL_DIR')) {
     define('PEAR_CONFIG_DEFAULT_PHP_DIR', getenv('PHP_PEAR_INSTALL_DIR'));
 } else {
-    if (@is_dir($PEAR_INSTALL_DIR)) {
+    if (file_exists($PEAR_INSTALL_DIR) && is_dir($PEAR_INSTALL_DIR)) {
         define('PEAR_CONFIG_DEFAULT_PHP_DIR',
                $PEAR_INSTALL_DIR);
     } else {
@@ -98,7 +98,8 @@
 } else {
     if (ini_get('extension_dir')) {
         define('PEAR_CONFIG_DEFAULT_EXT_DIR', ini_get('extension_dir'));
-    } elseif (defined('PEAR_EXTENSION_DIR') && @is_dir(PEAR_EXTENSION_DIR)) {
+    } elseif (defined('PEAR_EXTENSION_DIR') &&
+              file_exists(PEAR_EXTENSION_DIR) && is_dir(PEAR_EXTENSION_DIR)) {
         define('PEAR_CONFIG_DEFAULT_EXT_DIR', PEAR_EXTENSION_DIR);
     } elseif (defined('PHP_EXTENSION_DIR')) {
         define('PEAR_CONFIG_DEFAULT_EXT_DIR', PHP_EXTENSION_DIR);
@@ -543,7 +544,7 @@
         $this->layers = array_keys($this->configuration);
         $this->files['user'] = $user_file;
         $this->files['system'] = $system_file;
-        if ($user_file && @file_exists($user_file)) {
+        if ($user_file && file_exists($user_file)) {
             $this->pushErrorHandling(PEAR_ERROR_RETURN);
             $this->readConfigFile($user_file, 'user', $strict);
             $this->popErrorHandling();
@@ -552,7 +553,7 @@
             }
         }
 
-        if ($system_file && @file_exists($system_file)) {
+        if ($system_file && file_exists($system_file)) {
             $this->mergeConfigFile($system_file, false, 'system', $strict);
             if ($this->_errorsFound > 0) {
                 return;
@@ -904,16 +905,16 @@
         if (!@System::mkDir($opt)) {
             return $this->raiseError("could not create directory: " . 
dirname($file));
         }
-        if (@is_file($file) && !@is_writeable($file)) {
+        if (file_exists($file) && is_file($file) && !is_writeable($file)) {
             return $this->raiseError("no write access to $file!");
         }
         $fp = @fopen($file, "w");
         if (!$fp) {
-            return $this->raiseError("PEAR_Config::writeConfigFile 
fopen('$file','w') failed");
+            return $this->raiseError("PEAR_Config::writeConfigFile 
fopen('$file','w') failed ($php_errormsg)");
         }
         $contents = "#PEAR_Config 0.9\n" . serialize($data);
         if (!@fwrite($fp, $contents)) {
-            return $this->raiseError("PEAR_Config::writeConfigFile: fwrite 
failed");
+            return $this->raiseError("PEAR_Config::writeConfigFile: fwrite 
failed ($php_errormsg)");
         }
         return true;
     }
@@ -933,7 +934,10 @@
      */
     function _readConfigDataFrom($file)
     {
-        $fp = @fopen($file, "r");
+        $fp = false;
+        if (file_exists($file)) {
+            $fp = @fopen($file, "r");
+        }
         if (!$fp) {
             return $this->raiseError("PEAR_Config::readConfigFile 
fopen('$file','r') failed");
         }



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





Try Searching:
servers, voip, java, networking, microsoft ...
<Prev in Thread] Current Thread [Next in Thread>