Conversation
supportI have Debug Bar Actions and Filters Addon version 1.5.1 and it lacks of support for invokable objects http://php.net/manual/en/language.oop5.magic.php#object.invoke . when I register action or filter callable with invokable object plugin fails on function signature generation. Code sample to reproduce the issue: class InvokableClass {function __invoke() {/*code to run*/}} add_action('tag', new InvokableClass()); First error comes from wrong “Type 3 – closure within an array” detection on line 167 elseif ( ( is_array( $single_function['function'] ) || is_object( $single_function['function'] ) ) && dbafa_is_closure( $single_function['function'][0] ) ) should be elseif ( is_array( $single_function['function'] ) && is_object( $single_function['function'][0] ) && dbafa_is_closure( $single_function['function'][0] ) ) Second error is when unique callback counting takes place on line 207. This happense due ‘Type 8 – undetermined’ handling. It do not set signature and because object is not convertable to string (due lack of __toString()) we get “PHP Catchable fatal error”. I suggest to update “Type 8 – undetermined” handling by providing unique signature ex. $signature = uniqid('undetermined_callback_'); for future. Add support for invokable objects by adding new type like so: elseif ( is_object( $single_function['function'] ) && is_callable( $single_function['function'] ) ) { // Type 9 - closure within an array $signature = get_class( $single_function['function'] ) . ' -> __invoke'; $table .= '<li>[<em>' . esc_html__( 'object', 'debug-bar-actions-and-filters-addon' ) . '</em>] ' . $signature . '</li>'; } Snippet must be added after closure detection, otherwise it will catch them. This topic was modified 9 years, 8 months ago by eimanavicius . This topic was modified 9 years, 8 months ago by eimanavicius .
Thank you for reporting the issue and for the suggestion. I will have a look and release a new version with a patch. Thanks !!
Hi, I’m still waiting on this fix.
Hi Nerijius, I am sorry about the delay. I will work on it and release soon. You can track the progress through this ticket https://github.com/subharanjanm/debug-bar-actions-and-filters-addon/issues/19#issuecomment-266203422 Thanks for your patience. Thanks.
Thank you for reporting the issue and for the suggestion. I will have a look and release a new version with a patch. Thanks !!
Hi, I’m still waiting on this fix.
Hi Nerijius, I am sorry about the delay. I will work on it and release soon. You can track the progress through this ticket https://github.com/subharanjanm/debug-bar-actions-and-filters-addon/issues/19#issuecomment-266203422 Thanks for your patience. Thanks.