YahnisElsts / plugin-update-checker

A custom update checker for WordPress plugins. Useful if you don't want to host your project in the official WP repository, but would still like it to support automatic updates. Despite the name, it also works with themes.
MIT License
2.22k stars 403 forks source link

Debug_Bar_Panel class is missing #497

Closed light-source closed 2 years ago

light-source commented 2 years ago

Hello.

I see a fatal error, because Debug_Bar_Panel class is missing.

How to reproduce Use the package via composer (with scoper, not sure if it changes something in this case), and you will see a fatal error, that Debug_Bar_Panel class is not defined. The issues are in DebugBar/PluginPanel.php and DebugBar/ThemePanel.php files.

How to fix The class checking at the top of the files should be extended to && class_exists('Puc_v4p11_DebugBar_Panel'), similar to DebugBar/Panel.php

Thank you in advance for looking into it.

light-source commented 2 years ago

An update : after some research I've found that the scoper exposes global classes by default (so it tries to autoload all global classes by default), and solved with adding to an ignore list. Btw : I'm sharing my scoper's exclude list for functions and classes below, so you could add to your docs if you think it's useful for others return [ 'exclude-functions' => [ 'wp_normalize_path', 'apply_filters', 'add_filter', '__', 'esc_url', 'network_admin_url', 'esc_attr', 'wp_nonce_url', 'add_query_arg', 'check_admin_referer', 'set_site_transient', 'wp_redirect', 'get_site_transient', 'delete_site_transient', 'remove_action', 'remove_filter', 'plugin_basename', 'register_deactivation_hook', 'current_user_can', 'get_plugin_data', 'wp_next_scheduled', 'wp_schedule_event', 'wp_clear_scheduled_hook', 'current_filter', 'update_site_option', 'get_site_option', 'delete_site_option', 'did_action', 'is_admin', 'get_user_locale', 'get_locale', 'load_textdomain', 'get_core_updates', 'wp_remote_get', 'is_wp_error', 'do_action', 'get_available_languages', 'wp_get_installed_translations', 'trailingslashit', 'wp_remote_retrieve_response_code', 'wp_remote_retrieve_body', 'untrailingslashit', 'get_stylesheet', 'wp_get_theme', 'get_theme_root', 'get_plugins', 'get_submit_button', 'wp_create_nonce', 'human_time_diff', 'get_option', 'wp_enqueue_style', 'wp_enqueue_script', 'esc_html', 'wp_remote_retrieve_response_message', 'wp_remote_retrieve_headers', 'check_ajax_referer', 'plugins_url', 'get_theme_root_uri', 'balanceTags', 'wp_kses', ], 'exclude-classes' => [ 'Puc_v4p11_DebugBar_PluginPanel', 'Puc_v4p11_DebugBar_ThemePanel', ], ];