Title: Code assumes hook objects to be Closures
Last modified: July 20, 2021

---

# Code assumes hook objects to be Closures

 *  [leonboot](https://wordpress.org/support/users/leonboot/)
 * (@leonboot)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/code-assumes-hook-objects-to-be-closures/)
 * The `hide_unrelated_notices` method of the `WPMailSMTP\Admin\Area` class iterates
   over registered hooks and, if the hook is an object, assumes it is an instance
   of the class `Closure`. This, however, does not account for objects with an `
   __invoke()` method, which may be called as functions.
 * Instead of `$arr['function'] instanceof \Closure`, it would be nicer to use `
   is_callable($arr['function'])`.
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fcode-assumes-hook-objects-to-be-closures%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 1 replies (of 1 total)

 *  Plugin Author [Gregor Capuder](https://wordpress.org/support/users/capuderg/)
 * (@capuderg)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/code-assumes-hook-objects-to-be-closures/#post-14679829)
 * Hi [@leonboot](https://wordpress.org/support/users/leonboot/),
 * thanks for sharing this with us. We’ll look into it and update it in one of the
   next plugin updates.
 * Could you please let us know in which use case this has caused issues for you,
   so we can also test it out and make sure it works OK after the changes?
 * Thank you again and have a nice day!

Viewing 1 replies (of 1 total)

The topic ‘Code assumes hook objects to be Closures’ is closed to new replies.

 * ![](https://ps.w.org/wp-mail-smtp/assets/icon-256x256.png?rev=1755440)
 * [WP Mail SMTP by WPForms - The Most Popular SMTP and Email Log Plugin](https://wordpress.org/plugins/wp-mail-smtp/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-mail-smtp/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-mail-smtp/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-mail-smtp/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-mail-smtp/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-mail-smtp/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Gregor Capuder](https://wordpress.org/support/users/capuderg/)
 * Last activity: [4 years, 10 months ago](https://wordpress.org/support/topic/code-assumes-hook-objects-to-be-closures/#post-14679829)
 * Status: not a support question