cvs: pear-core / PEAR.php
| From: | Helgi �ormar �orbj�rnsson | Date: | Sat, 14 Jun 2008 08:47:34 +0000 |
| Subject: | cvs: pear-core / PEAR.php | ||
| Groups: | php.pear.cvs php.pear.core | ||
| Request: | Send a blank email to pear-core+get-7595@lists.php.net to get a copy of this message | ||
dufuz Sat Jun 14 08:47:34 2008 UTC
Modified files:
/pear-core PEAR.php
Log:
Add a bit hackish but working way of getting rid of the strict warning in the shutdown function
that wasn't being suppressed like it should.
Those that want can use PEAR5::getStaticProperty if you want a PHP 5 strict thingy for this
http://cvs.php.net/viewvc.cgi/pear-core/PEAR.php?r1=1.104&r2=1.105&diff_format=u
Index: pear-core/PEAR.php
diff -u pear-core/PEAR.php:1.104 pear-core/PEAR.php:1.105
--- pear-core/PEAR.php:1.104 Thu Jan 3 20:26:34 2008
+++ pear-core/PEAR.php Sat Jun 14 08:47:34 2008
@@ -20,7 +20,7 @@
* @author Greg Beaver <cellog@php.net>
* @copyright 1997-2008 The PHP Group
* @license http://www.php.net/license/3_0.txt
PHP License 3.0
- * @version CVS: $Id: PEAR.php,v 1.104 2008/01/03 20:26:34 cellog Exp $
+ * @version CVS: $Id: PEAR.php,v 1.105 2008/06/14 08:47:34 dufuz Exp $
* @link http://pear.php.net/package/PEAR
* @since File available since Release 0.1
*/
@@ -768,6 +768,40 @@
// }}}
}
+if (PEAR_ZE2) {
+ /**
+ * This is only meant for PHP 5 to get rid of certain strict warning
+ * that doesn't get hidden since it's in the shutdown function
+ */
+ class PEAR5
+ {
+ /**
+ * 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');
+ *
+ * @access public
+ * @param string $class The calling classname, to prevent clashes
+ * @param string $var The variable to retrieve.
+ * @return mixed A reference to the variable. If not set it will be
+ * auto initialised to NULL.
+ */
+ static function getStaticProperty($class, $var)
+ {
+ static $properties;
+ if (!isset($properties[$class])) {
+ $properties[$class] = array();
+ }
+
+ if (!array_key_exists($var, $properties[$class])) {
+ $properties[$class][$var] = null;
+ }
+
+ return $properties[$class][$var];
+ }
+ }
+}
+
// {{{ _PEAR_call_destructors()
function _PEAR_call_destructors()
@@ -777,9 +811,16 @@
sizeof($_PEAR_destructor_object_list))
{
reset($_PEAR_destructor_object_list);
- if (PEAR::getStaticProperty('PEAR', 'destructlifo')) {
+ if (PEAR_ZE2) {
+ $destructLifoExists = PEAR5::getStaticProperty('PEAR',
'destructlifo');
+ } else {
+ $destructLifoExists = PEAR::getStaticProperty('PEAR',
'destructlifo');
+ }
+
+ if ($destructLifoExists) {
$_PEAR_destructor_object_list = array_reverse($_PEAR_destructor_object_list);
}
+
while (list($k, $objref) = each($_PEAR_destructor_object_list)) {
$classname = get_class($objref);
while ($classname) {