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

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



Reply via email to