diff options
author | Christoph M. Becker <cmbecker69@gmx.de> | 2019-09-18 11:55:20 +0200 |
---|---|---|
committer | Christoph M. Becker <cmbecker69@gmx.de> | 2019-09-19 09:13:22 +0200 |
commit | 9dfbcd7248012ac651a48eb871bfa58bb9e6c5d7 (patch) | |
tree | 1f7527174352bac7a8d0685d03a396406f9bc77a /Zend/zend_API.c | |
parent | 38ae5224403499921b9a145255310f4a0f781d38 (diff) | |
download | php-git-9dfbcd7248012ac651a48eb871bfa58bb9e6c5d7.tar.gz |
Fix #78543: is_callable() on FFI\CData throws Exception
If `Z_OBJ_HANDLER_P(callable, get_closure)` throws, we must not let the
exeception pass to userland, if called through `is_callable()`.
Diffstat (limited to 'Zend/zend_API.c')
-rw-r--r-- | Zend/zend_API.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 89e9c9d849..5be9d94dee 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -3411,12 +3411,17 @@ check_func: } return 0; case IS_OBJECT: - if (Z_OBJ_HANDLER_P(callable, get_closure) && Z_OBJ_HANDLER_P(callable, get_closure)(callable, &fcc->calling_scope, &fcc->function_handler, &fcc->object) == SUCCESS) { - fcc->called_scope = fcc->calling_scope; - if (fcc == &fcc_local) { - zend_release_fcall_info_cache(fcc); + if (Z_OBJ_HANDLER_P(callable, get_closure)) { + if (Z_OBJ_HANDLER_P(callable, get_closure)(callable, &fcc->calling_scope, &fcc->function_handler, &fcc->object) == SUCCESS) { + fcc->called_scope = fcc->calling_scope; + if (fcc == &fcc_local) { + zend_release_fcall_info_cache(fcc); + } + return 1; + } else { + /* Discard exceptions thrown from Z_OBJ_HANDLER_P(callable, get_closure) */ + zend_clear_exception(); } - return 1; } if (error) *error = estrdup("no array or string given"); return 0; |