allow extension writers to ignore E_NOTICE warnings about unset variables
| From: | D. Dante Lorenso | Date: | Thu, 11 May 2006 22:49:45 +0000 |
| Subject: | allow extension writers to ignore E_NOTICE warnings about unset variables | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-23285@lists.php.net to get a copy of this message | ||
All,
Is there a way to define a function in an extension which would not require a passed in variable to exist? In other words, can ZE be modified to allow extensions to not trigger E_NOTICE warnings if an unset variable is passed to a function which does not care if the var is set?
I can specify preferences about whether variables are passed by reference or not using macros like:
* PHP_FE(..., first_arg_force_ref)
* PHP_FE(..., third_arg_force_by_ref_rest)
* PHP_FE(..., first_through_third_args_force_ref)
Which probably boil down somewhere into:
* #define ZEND_SEND_BY_VAL 0 * #define ZEND_SEND_BY_REF 1* #define ZEND_SEND_PREFER_REF 2 And I notice that if a variable is passed by reference to an extension function, no E_NOTICE is thrown. Well, can we extend this concept further to say something like: * #define ZEND_SEND_WHO_CARES_IF_IT_EXISTS_OR_NOT 4 *but with a better name, of course* Then, extension developers can write 'ifsetor', 'coalesce', and 'filled' as extensions (by themselves) and not need those specific functions added to the 'PHP core language' per-se. Dante