]> granicus.if.org Git - php/commitdiff
Merge branch 'PHP-7.4'
authorChristoph M. Becker <cmbecker69@gmx.de>
Thu, 19 Sep 2019 07:17:53 +0000 (09:17 +0200)
committerChristoph M. Becker <cmbecker69@gmx.de>
Thu, 19 Sep 2019 07:17:53 +0000 (09:17 +0200)
* PHP-7.4:
  Fix #78543: is_callable() on FFI\CData throws Exception

1  2 
Zend/zend_API.c

diff --cc Zend/zend_API.c
index 1ace606a7e459cf0223ce58ebd9b12dbfdf9c1f2,5be9d94dee3160cfbf42ebbea4560057010114e4..ad61ad66249dbbdb452aa9c44b31ddce13da4033
@@@ -3230,12 -3411,17 +3230,18 @@@ check_func
                        }
                        return 0;
                case IS_OBJECT:
-                       if (Z_OBJ_HANDLER_P(callable, get_closure) && Z_OBJ_HANDLER_P(callable, get_closure)(Z_OBJ_P(callable), &fcc->calling_scope, &fcc->function_handler, &fcc->object) == SUCCESS) {
+                       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;
++                              if (Z_OBJ_HANDLER_P(callable, get_closure)(Z_OBJ_P(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) */
++                                      /* Discard exceptions thrown from Z_OBJ_HANDLER_P(callable, get_closure)
++                                         TODO: extend get_closure() with additional argument and prevent exception throwing in the first place */
+                                       zend_clear_exception();
 -                              }
++                      }
                        }
                        if (error) *error = estrdup("no array or string given");
                        return 0;