Re: small patch to DB/common.php

From: Date: Wed, 30 Jul 2003 01:24:36 +0000
Subject: Re: small patch to DB/common.php
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-18918@lists.php.net to get a copy of this message
Sounds a bit like a bug in PHP5. - have a try on zend-engine2 mailing list.. see if there was a definitive direction on this.. Regards Alan Brad Bulger wrote:
php 5 does not allow 'return new FooClass;' from a method declared as returning a reference ('function &getMyFoo()'). DB does this in a couple places. The patch just changes it to do $dbr =& new Whatever; return $dbr;
------------------------------------------------------------------------ Index: common.php =================================================================== RCS file: /repository/pear/DB/DB/common.php,v retrieving revision 1.22 diff -u -u -r1.22 common.php --- common.php 22 Jul 2003 21:54:16 -0000 1.22 +++ common.php 25 Jul 2003 07:12:57 -0000 @@ -565,7 +565,8 @@
         if (DB::isError($result) || $result === DB_OK) {
             return $result;
         } else {
-            return new DB_result($this, $result);
+            $dbr =& new DB_result($this, $result);
+            return $dbr;
         }
     }
 @@ -763,7 +764,8 @@
             if (DB::isError($result) || $result === DB_OK) {
                 return $result;
             } else {
-                return new DB_result($this, $result);
+                $dbr =& new DB_result($this, $result);
+                return $dbr;
             }
         }
     }
-- Can you help out? Need Consulting Services or Know of a Job? http://www.akbkhome.com

« previous php.pear.dev (#18918) next »