> Hello Andi,
> 
> i brought the fact up nearly a year ago and i very much appreciate
> the simple solution of changing the return value. Since the old way
> is bork anyways i am all fine (+1). One of the most annoying problems is
> that several function force you to test against NULL and FALSE.
> NULL for all the internal errors and FLASE for real function errors.
> 
> So today you have places that require you to do:
>   $ret = func_call();
>   if ($ret !== NULL && $ret !== false) ....
>

or

if ($ret)

not too hard.

-sterling


> marcus
> 
> Wednesday, February 4, 2004, 12:09:14 PM, you wrote:
> 
> > Hey guys,
> 
> > Ilia raises a valid point here. We are quite inconsistent today when it 
> > comes to return values. In ext, for example, most functions return FALSE 
> > and not NULL (roughly about 2910 vs. 47), however, by default (before the 
> > function is called) the return_value is set to the NULL value (so functions
> > which just return, not sure how often that happens, will result in NULL); 
> > and more importantly ZEND_FETCH_RESOURCE() returns NULL on failure.
> > Now there are some cases where you really want to return NULL on failure 
> > because FALSE might be a valid return value but in most cases this is not true.
> > The real question is, do we change the default return_value to FALSE and 
> > change ZEND_FETCH_RESOURCE() to return FALSE and try and standardize for 
> > PHP 5 (and risk breaking people's scripts, mainly people using === and !==)
> > or do we stick to the status quo?
> 
> > Andi
> 
> >>From: Ilia Alshanetsky <[EMAIL PROTECTED]>
> >>To: Andi Gutmans <[EMAIL PROTECTED]>
> >>Subject: ZEND_VERIFY_RESOURCE() question
> >>Date: Sat, 3 Jan 2004 17:08:36 -0500
> >>
> >>Hi Andi,
> >>
> >>A quick question if you don't mind. It seems that the ZEND_VERIFY_RESOURCE()
> >>macro returns NULL of failure, while mostly used in functions that normally
> >>return FALSE on failure, causing issues such as the one described by bug
> >>#26772. I am wondering if it would make sense to alter the macro to return
> >>FALSE rather then NULL.
> >>
> >>Ilia
> 
> 
> 
> 
> -- 
> Best regards,
>  Marcus                            mailto:[EMAIL PROTECTED]
> 
> -- 
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

-- 
"Reductionists like to take things apart.  The rest of us are
 just trying to get it together."
    - Larry Wall, Programming Perl, 3rd Edition

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to