Re: PHP 5.0.3 E_STRICT question - returning NULL from reference returning function
| From: | Derick Rethans | Date: | Sun, 06 Mar 2005 15:06:39 +0000 |
| Subject: | Re: PHP 5.0.3 E_STRICT question - returning NULL from reference returning function | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-15285@lists.php.net to get a copy of this message | ||
On Sun, 6 Mar 2005, Zeev Suraski wrote:
> At 06:47 06/03/2005, Yermo Lamers wrote:
>
> >What is the proper way to return a NULL condition from a method that
> >returns a reference?
> >
> >function &testfunc()
> >{
> >return NULL;
> >}
> >
> >generates:
> >
> >"Strict Standards: Only variable references should be returned by
> >reference in ..."
> >
> >Is the correct approach to do something like:
> >
> >function &testfunc()
> >{
> >$nullVar = NULL;
> >return $nullVar;
> >}
>
> That'd work, yep.
Wrong ;-) It causes problems with reference counting - and will segfault
PHP after some time.
Derick
--
Derick Rethans
http://derickrethans.nl | http://ez.no | http://xdebug.org