cvs: pear-core /PEAR Config.php

From: Date: Sun, 20 Feb 2005 21:00:34 +0000
Subject: cvs: pear-core /PEAR Config.php
Groups: php.pear.cvs php.pear.core 
Request: Send a blank email to pear-cvs+get-29564@lists.php.net to get a copy of this message
cellog Sun Feb 20 16:00:34 2005 EDT Modified files: /pear-core/PEAR Config.php Log: Now that we have a default registry, getRegistry() should always return a valid registry object http://cvs.php.net/diff.php/pear-core/PEAR/Config.php?r1=1.94&r2=1.95&ty=u Index: pear-core/PEAR/Config.php diff -u pear-core/PEAR/Config.php:1.94 pear-core/PEAR/Config.php:1.95 --- pear-core/PEAR/Config.php:1.94 Sun Feb 20 15:58:14 2005 +++ pear-core/PEAR/Config.php Sun Feb 20 16:00:33 2005 @@ -17,7 +17,7 @@ // | Greg Beaver <cellog@php.net> | // +----------------------------------------------------------------------+ // -// $Id: Config.php,v 1.94 2005/02/20 20:58:14 cellog Exp $ +// $Id: Config.php,v 1.95 2005/02/20 21:00:33 cellog Exp $ require_once 'PEAR.php'; require_once 'PEAR/Registry.php'; @@ -1747,17 +1747,21 @@ /** * @return PEAR_Registry */ - function &getRegistry($layer = 'user') + function &getRegistry($use = null) { + if ($use === null) { + $layer = 'user'; + } else { + $layer = $use; + } if (isset($this->_registry[$layer])) { return $this->_registry[$layer]; - } elseif ($layer == 'user' && isset($this->_registry['system'])) { + } elseif ($use === null && isset($this->_registry['system'])) { return $this->_registry['system']; - } elseif ($layer == 'user' && isset($this->_registry['default'])) { + } elseif ($use === null && isset($this->_registry['default'])) { return $this->_registry['default']; } else { - $a = false; - return $a; + die("CRITICAL ERROR: Registry could not be initialized from any value"); } } /**

« previous php.pear.cvs (#29564) next »