logo       
Google Custom Search
    AddThis Social Bookmark Button

cvs: pear-core /PEAR Config.php /PEAR/Installer Role.php: msg#00020

Subject: cvs: pear-core /PEAR Config.php /PEAR/Installer Role.php
cellog          Mon Oct 29 05:42:11 2007 UTC

  Modified files:              
    /pear-core/PEAR     Config.php 
    /pear-core/PEAR/Installer   Role.php 
  Log:
  better fix for initializeConfig, don't register config vars twice for the 
same config class
  
http://cvs.php.net/viewvc.cgi/pear-core/PEAR/Config.php?r1=1.141&r2=1.142&diff_format=u
Index: pear-core/PEAR/Config.php
diff -u pear-core/PEAR/Config.php:1.141 pear-core/PEAR/Config.php:1.142
--- pear-core/PEAR/Config.php:1.141     Sun Oct 28 05:15:31 2007
+++ pear-core/PEAR/Config.php   Mon Oct 29 05:42:10 2007
@@ -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.141 2007/10/28 05:15:31 cellog Exp $
+ * @version    CVS: $Id: Config.php,v 1.142 2007/10/29 05:42:10 cellog Exp $
  * @link       http://pear.php.net/package/PEAR
  * @since      File available since Release 0.1
  */
@@ -1077,12 +1077,18 @@
     // }}}
 
     /**
+     * @param string Configuration class name, used for detecting duplicate 
calls
      * @param array information on a role as parsed from its xml file
      * @return true|PEAR_Error
      * @access private
      */
-    function _addConfigVars($vars)
+    function _addConfigVars($class, $vars)
     {
+        static $called = array();
+        if (isset($called[$class])) {
+            return;
+        }
+        $called[$class] = 1;
         if (count($vars) > 3) {
             return $this->raiseError('Roles can only define 3 new config 
variables or less');
         }
http://cvs.php.net/viewvc.cgi/pear-core/PEAR/Installer/Role.php?r1=1.18&r2=1.19&diff_format=u
Index: pear-core/PEAR/Installer/Role.php
diff -u pear-core/PEAR/Installer/Role.php:1.18 
pear-core/PEAR/Installer/Role.php:1.19
--- pear-core/PEAR/Installer/Role.php:1.18      Sun Oct 28 05:11:25 2007
+++ pear-core/PEAR/Installer/Role.php   Mon Oct 29 05:42:11 2007
@@ -15,7 +15,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: Role.php,v 1.18 2007/10/28 05:11:25 cellog Exp $
+ * @version    CVS: $Id: Role.php,v 1.19 2007/10/29 05:42:11 cellog Exp $
  * @link       http://pear.php.net/package/PEAR
  * @since      File available since Release 1.4.0a1
  */
@@ -47,11 +47,6 @@
      */
     function initializeConfig(&$config)
     {
-        static $called = false;
-        if ($called) {
-            return;
-        }
-        $called = true;
         if (!isset($GLOBALS['_PEAR_INSTALLER_ROLES'])) {
             PEAR_Installer_Role::registerRoles();
         }
@@ -59,7 +54,7 @@
             if (!$info['config_vars']) {
                 continue;
             }
-            $config->_addConfigVars($info['config_vars']);
+            $config->_addConfigVars($class, $info['config_vars']);
         }
     }
 

-- 
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>