[PATCH] Bug #30230 exception handler not working with objects
| From: | Robert Silva | Date: | Tue, 12 Oct 2004 06:44:08 +0000 |
| Subject: | [PATCH] Bug #30230 exception handler not working with objects | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-13273@lists.php.net to get a copy of this message | ||
The problem is that set_exception_handler allows you to reset the handler by
passing an empty string as argument. It did not check to make sure it was a
string before checking strlen, therefore when passed an array, it assumed
the user was resetting the handler. This patch only resets when an empty
string is passed in (an array will set a new handler).
Bob Silva
--- zend_builtin_functions.c 2004-10-11 23:04:15.000000000 -0700 +++ zend_builtin_functions.c 2004-10-11 23:08:10.000000000 -0700 @@ -1125,7 +1125,7 @@ } ALLOC_ZVAL(EG(user_exception_handler)); - if (Z_STRLEN_PP(exception_handler)==0) { /* unset user-defined handler */ + if (Z_TYPE_PP(exception_handler) == IS_STRING && Z_STRLEN_PP(exception_handler)==0) { /* unset user-defined handler */ FREE_ZVAL(EG(user_exception_handler)); EG(user_exception_handler) = NULL; RETURN_TRUE;
--- zend_builtin_functions.c 2004-10-11 23:04:15.000000000 -0700 +++ zend_builtin_functions.c 2004-10-11 23:08:10.000000000 -0700 @@ -1125,7 +1125,7 @@ } ALLOC_ZVAL(EG(user_exception_handler)); - if (Z_STRLEN_PP(exception_handler)==0) { /* unset user-defined handler */ + if (Z_TYPE_PP(exception_handler) == IS_STRING && Z_STRLEN_PP(exception_handler)==0) { /* unset user-defined handler */ FREE_ZVAL(EG(user_exception_handler)); EG(user_exception_handler) = NULL; RETURN_TRUE;