From 33fa7ae74bebc6c0db731866c403506595e52bc3 Mon Sep 17 00:00:00 2001
From: prasad <prasad@vtiger.com>
Date: Wed, 13 Jul 2016 23:56:49 +0530
Subject: [PATCH] Fixed syntax (assigning references) used in PEAR for PHP 7
 compat.

---
 PEAR.php | 46 +++++++++++++++++++++++-----------------------
 1 file changed, 23 insertions(+), 23 deletions(-)

diff --git a/PEAR.php b/PEAR.php
index a29bf8bd3..a94a3de41 100644
--- a/PEAR.php
+++ b/PEAR.php
@@ -84,7 +84,7 @@ $GLOBALS['_PEAR_error_handler_stack']    = array();
  * destructor, use error_log(), syslog() or something similar.
  *
  * IMPORTANT! To use the emulated destructors you need to create the
- * objects by reference: $obj =& new PEAR_child;
+ * objects by reference: $obj = new PEAR_child;
  *
  * @category   pear
  * @package    PEAR
@@ -180,7 +180,7 @@ class PEAR
             $destructor = "_$classname";
             if (method_exists($this, $destructor)) {
                 global $_PEAR_destructor_object_list;
-                $_PEAR_destructor_object_list[] = &$this;
+                $_PEAR_destructor_object_list[] = $this;
                 if (!isset($GLOBALS['_PEAR_SHUTDOWN_REGISTERED'])) {
                     register_shutdown_function("_PEAR_call_destructors");
                     $GLOBALS['_PEAR_SHUTDOWN_REGISTERED'] = true;
@@ -218,7 +218,7 @@ class PEAR
     /**
     * 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 = &PEAR::getStaticProperty('myclass', 'myVar');
+    * do this: $myVar = PEAR::getStaticProperty('myclass', 'myVar');
     * You MUST use a reference, or they will not persist!
     *
     * @access public
@@ -323,11 +323,11 @@ class PEAR
     function setErrorHandling($mode = null, $options = null)
     {
         if (isset($this) && is_a($this, 'PEAR')) {
-            $setmode     = &$this->_default_error_mode;
-            $setoptions  = &$this->_default_error_options;
+            $setmode     = $this->_default_error_mode;
+            $setoptions  = $this->_default_error_options;
         } else {
-            $setmode     = &$GLOBALS['_PEAR_default_error_mode'];
-            $setoptions  = &$GLOBALS['_PEAR_default_error_options'];
+            $setmode     = $GLOBALS['_PEAR_default_error_mode'];
+            $setoptions  = $GLOBALS['_PEAR_default_error_options'];
         }
 
         switch ($mode) {
@@ -554,10 +554,10 @@ class PEAR
             $ec = 'PEAR_Error';
         }
         if ($skipmsg) {
-            $a = &new $ec($code, $mode, $options, $userinfo);
+            $a = new $ec($code, $mode, $options, $userinfo);
             return $a;
         } else {
-            $a = &new $ec($message, $code, $mode, $options, $userinfo);
+            $a = new $ec($message, $code, $mode, $options, $userinfo);
             return $a;
         }
     }
@@ -577,10 +577,10 @@ class PEAR
                          $userinfo = null)
     {
         if (isset($this) && is_a($this, 'PEAR')) {
-            $a = &$this->raiseError($message, $code, null, null, $userinfo);
+            $a = $this->raiseError($message, $code, null, null, $userinfo);
             return $a;
         } else {
-            $a = &PEAR::raiseError($message, $code, null, null, $userinfo);
+            $a = PEAR::raiseError($message, $code, null, null, $userinfo);
             return $a;
         }
     }
@@ -588,9 +588,9 @@ class PEAR
     // }}}
     function staticPushErrorHandling($mode, $options = null)
     {
-        $stack = &$GLOBALS['_PEAR_error_handler_stack'];
-        $def_mode    = &$GLOBALS['_PEAR_default_error_mode'];
-        $def_options = &$GLOBALS['_PEAR_default_error_options'];
+        $stack = $GLOBALS['_PEAR_error_handler_stack'];
+        $def_mode    = $GLOBALS['_PEAR_default_error_mode'];
+        $def_options = $GLOBALS['_PEAR_default_error_options'];
         $stack[] = array($def_mode, $def_options);
         switch ($mode) {
             case PEAR_ERROR_EXCEPTION:
@@ -623,9 +623,9 @@ class PEAR
 
     function staticPopErrorHandling()
     {
-        $stack = &$GLOBALS['_PEAR_error_handler_stack'];
-        $setmode     = &$GLOBALS['_PEAR_default_error_mode'];
-        $setoptions  = &$GLOBALS['_PEAR_default_error_options'];
+        $stack = $GLOBALS['_PEAR_error_handler_stack'];
+        $setmode     = $GLOBALS['_PEAR_default_error_mode'];
+        $setoptions  = $GLOBALS['_PEAR_default_error_options'];
         array_pop($stack);
         list($mode, $options) = $stack[sizeof($stack) - 1];
         array_pop($stack);
@@ -673,13 +673,13 @@ class PEAR
      */
     function pushErrorHandling($mode, $options = null)
     {
-        $stack = &$GLOBALS['_PEAR_error_handler_stack'];
+        $stack = $GLOBALS['_PEAR_error_handler_stack'];
         if (isset($this) && is_a($this, 'PEAR')) {
-            $def_mode    = &$this->_default_error_mode;
-            $def_options = &$this->_default_error_options;
+            $def_mode    = $this->_default_error_mode;
+            $def_options = $this->_default_error_options;
         } else {
-            $def_mode    = &$GLOBALS['_PEAR_default_error_mode'];
-            $def_options = &$GLOBALS['_PEAR_default_error_options'];
+            $def_mode    = $GLOBALS['_PEAR_default_error_mode'];
+            $def_options = $GLOBALS['_PEAR_default_error_options'];
         }
         $stack[] = array($def_mode, $def_options);
 
@@ -704,7 +704,7 @@ class PEAR
     */
     function popErrorHandling()
     {
-        $stack = &$GLOBALS['_PEAR_error_handler_stack'];
+        $stack = $GLOBALS['_PEAR_error_handler_stack'];
         array_pop($stack);
         list($mode, $options) = $stack[sizeof($stack) - 1];
         array_pop($stack);
-- 
GitLab