fix image text
[pear] / PEAR.php
index 1d9a524..c7ddbf8 100644 (file)
--- a/PEAR.php
+++ b/PEAR.php
@@ -146,10 +146,9 @@ class PEAR
      * @access public
      * @return void
      */
-    function PEAR($error_class = null)
+    function __construct($error_class = null)
     {
         $classname = strtolower(get_class($this));
-        print_R($classname);exit;
         if ($this->_debug) {
             print "PEAR constructor called, class=$classname\n";
         }
@@ -226,7 +225,7 @@ class PEAR
     * @param  mixed $args  The arguments to pass to the function
     * @return void
     */
-    function registerShutdownFunc($func, $args = array())
+    static function registerShutdownFunc($func, $args = array())
     {
         // if we are called statically, there is a potential
         // that no shutdown func is registered.  Bug #6445
@@ -707,12 +706,12 @@ class PEAR
     * @param string $ext The extension name
     * @return bool Success or not on the dl() call
     */
-    function loadExtension($ext)
+    static function loadExtension($ext)
     {
         if (extension_loaded($ext)) {
             return true;
         }
-
+        
         // if either returns true dl() will produce a FATAL error, stop that
         if (
             function_exists('dl') === false ||
@@ -759,7 +758,7 @@ function _PEAR_call_destructors()
             $_PEAR_destructor_object_list = array_reverse($_PEAR_destructor_object_list);
         }
 
-        while (list($k, $objref) = each($_PEAR_destructor_object_list)) {
+        foreach($_PEAR_destructor_object_list  as $k => $objref){
             $classname = get_class($objref);
             while ($classname) {
                 $destructor = "_$classname";
@@ -814,7 +813,7 @@ class PEAR_Error
     var $message              = '';
     var $userinfo             = '';
     var $backtrace            = null;
-
+    var $callback;
     /**
      * PEAR_Error constructor
      *
@@ -835,7 +834,7 @@ class PEAR_Error
      * @access public
      *
      */
-    function PEAR_Error($message = 'unknown error', $code = null,
+    function __construct($message = 'unknown error', $code = null,
                         $mode = null, $options = null, $userinfo = null)
     {
         if ($mode === null) {
@@ -904,8 +903,8 @@ class PEAR_Error
         }
 
         if ($this->mode & PEAR_ERROR_EXCEPTION) {
-            trigger_error("PEAR_ERROR_EXCEPTION is obsolete, use class PEAR_Exception for exceptions", E_USER_WARNING);
-            eval('$e = new Exception($this->message, $this->code);throw($e);');
+            //trigger_error("PEAR_ERROR_EXCEPTION is obsolete, use class PEAR_Exception for exceptions", E_USER_WARNING);
+           $e = new Exception($this->message, $this->code);throw($e);
         }
     }
 
@@ -1063,7 +1062,7 @@ class PEAR_Error
                        strtolower(get_class($this)), $this->message, $this->code,
                        implode("|", $modes), $levels[$this->level],
                        $this->error_message_prefix,
-                       $this->userinfo);
+                       is_string($this->userinfo) ? $this->userinfo : print_r($this->userinfo,true));
     }
 }