Howdy,
I hope this isn't too late to get in, but I found a problem in
set_error_handler() when trying to use an object method as an error handler.
I have a patch against php-4.3.1 for Zend/zend_builtin_functions.c
set_error_handler was assuming that the value passed in to the function
was a string, and hence
the test for Z_STRLEN_PP(error_handler) was always 0 if it was called as
follows
set_error_handler( array(&$this, "myhandler") );
This patch makes sure the type of the var error_handler is a string
before testing the length
of the name.
My question is, why does this block RETURN_TRUE if we set
EG(user_error_handler) = NULL; ? shouldn't we return false here?
Walt
[root@hemna src]# diff -u php-4.3.1/Zend/zend_builtin_functions.c
php-4.3.1-walt/Zend/zend_builtin_functions.c
--- php-4.3.1/Zend/zend_builtin_functions.c 2002-11-27
12:11:10.000000000 -0800
+++ php-4.3.1-walt/Zend/zend_builtin_functions.c 2003-05-14
13:15:39.000000000 -0700
@@ -891,7 +891,8 @@
}
ALLOC_ZVAL(EG(user_error_handler));
-
if (Z_STRLEN_PP(error_handler)==0) { /* unset user-defined
handler */
- /* Make sure we test for an empty string on a non-array value here */
-
if (Z_TYPE_PP(error_handler) == IS_STRING &&
Z_STRLEN_PP(error_handler)==0) { /* unset user-defined handler */
FREE_ZVAL(EG(user_error_handler));
EG(user_error_handler) = NULL;
RETURN_TRUE;