cvs: pear-core / PEAR.php
| From: | Helgi �ormar �orbj�rnsson | Date: | Wed, 08 Apr 2009 23:32:04 +0000 |
| Subject: | cvs: pear-core / PEAR.php | ||
| Groups: | php.pear.cvs php.pear.core | ||
| Request: | Send a blank email to pear-core+get-8306@lists.php.net to get a copy of this message | ||
dufuz Wed Apr 8 23:32:04 2009 UTC
Modified files:
/pear-core PEAR.php
Log:
Bug #16077 PEAR5::getStaticProperty does not return a reference to the property
http://cvs.php.net/viewvc.cgi/pear-core/PEAR.php?r1=1.110&r2=1.111&diff_format=u
Index: pear-core/PEAR.php
diff -u pear-core/PEAR.php:1.110 pear-core/PEAR.php:1.111
--- pear-core/PEAR.php:1.110 Tue Feb 24 23:52:56 2009
+++ pear-core/PEAR.php Wed Apr 8 23:32:04 2009
@@ -14,7 +14,7 @@
* @author Greg Beaver <cellog@php.net>
* @copyright 1997-2009 The Authors
* @license http://opensource.org/licenses/bsd-license.php
New BSD License
- * @version CVS: $Id: PEAR.php,v 1.110 2009/02/24 23:52:56 dufuz Exp $
+ * @version CVS: $Id: PEAR.php,v 1.111 2009/04/08 23:32:04 dufuz Exp $
* @link http://pear.php.net/package/PEAR
* @since File available since Release 0.1
*/
@@ -218,9 +218,11 @@
if (!isset($properties[$class])) {
$properties[$class] = array();
}
+
if (!array_key_exists($var, $properties[$class])) {
$properties[$class][$var] = null;
}
+
return $properties[$class][$var];
}
@@ -770,7 +772,8 @@
/**
* If you have a class that's mostly/entirely static, and you need static
* properties, you can use this method to simulate them. Eg. in your method(s)
- * do this: $myVar = PEAR5::getStaticProperty('myclass', 'myVar');
+ * do this: $myVar = &PEAR5::getStaticProperty('myclass', 'myVar');
+ * You MUST use a reference, or they will not persist!
*
* @access public
* @param string $class The calling classname, to prevent clashes
@@ -778,7 +781,7 @@
* @return mixed A reference to the variable. If not set it will be
* auto initialised to NULL.
*/
- static function getStaticProperty($class, $var)
+ static function &getStaticProperty($class, $var)
{
static $properties;
if (!isset($properties[$class])) {