On Wed, 2004-02-25 at 15:41, Andi Gutmans wrote:
> Quick reminder...
> If you have any bugs to fix, please fix them in the coming days.
Not a bug, but a feature request - make set_exception_handler() accept
the meta-type "callable" instead of only strings.
- Timm
Index: Zend/zend_builtin_functions.c
===================================================================
RCS file: /repository/ZendEngine2/zend_builtin_functions.c,v
retrieving revision 1.223
diff -u -r1.223 zend_builtin_functions.c
--- Zend/zend_builtin_functions.c 25 Feb 2004 21:06:59 -0000 1.223
+++ Zend/zend_builtin_functions.c 26 Feb 2004 03:13:17 -0000
@@ -1000,18 +1000,26 @@
/* }}} */
-/* {{{ proto string set_exception_handler(string exception_handler)
+/* {{{ proto string set_exception_handler(callable exception_handler)
Sets a user-defined exception handler function. Returns the previously defined exception handler, or false on error */
ZEND_FUNCTION(set_exception_handler)
{
zval **exception_handler;
+ char *exception_handler_name = NULL;
zend_bool had_orig_exception_handler=0;
if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &exception_handler)==FAILURE) {
ZEND_WRONG_PARAM_COUNT();
}
- convert_to_string_ex(exception_handler);
+ if (!zend_is_callable(*exception_handler, 0, &exception_handler_name)) {
+ zend_error(E_WARNING, "%s() expects the argument (%s) to be a valid callback",
+ get_active_function_name(TSRMLS_C), exception_handler_name?exception_handler_name:"unknown");
+ efree(exception_handler_name);
+ return;
+ }
+ efree(exception_handler_name);
+
if (EG(user_exception_handler)) {
had_orig_exception_handler = 1;
*return_value = *EG(user_exception_handler);
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php