Re: db and php5
| From: | Analysis & Solutions | Date: | Wed, 12 Nov 2003 16:25:11 +0000 |
| Subject: | Re: db and php5 | ||
| References: | 1 2 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-23539@lists.php.net to get a copy of this message | ||
Hi Lukas:
On Wed, Nov 12, 2003 at 03:38:29PM +0100, Lukas Smith wrote:
>
> without having run any tests .. is the following really necessary?
>
> - return DB_OK;
> + $res = DB_OK;
> + return $res;
Here's a test...
define('DB_OK', 1);
function &blah() {
return DB_OK;
}
$y =& blah();
echo $y;
Well, this runs without complaining. But, this may or may not be the
correct behavior. Considering old code using return expressions by
reference ran without raising runtime errors/warnings for years (but
actually caused memory corruption problems), though now causes the parser
to stop dead in it's tracks, thereby creating the headache of having to
rewrite code, it seems a good idea to really make sure "return DB_OK" is
the legitimate/intended behavior, so if it turns out not to be, we won't
have to go back again and fix it later. (How's that for a run-on
sentence?! :) )
I will look into this and get back to the list.
Enjoy,
--Dan
--
FREE scripts that make web and database programming easier
http://www.analysisandsolutions.com/software/
T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
4015 7th Ave #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409