Undefined errors on initial install
-
Hi, just trying this plugin, the first thing happened was errors on the Forums page listing the forums, has anyone seen this:
On initial install:
[25-Aug-2017 00:22:00 UTC] PHP Notice: Undefined variable: args in wp-content/plugins/bbp-toolkit/includes/go-functions.php on line 65After saving settings for this plugin:
[25-Aug-2017 00:23:29 UTC] PHP Notice: Undefined index: forum_id in wp-content/plugins/bbpress/includes/forums/template.php on line 767
-
Hi, looking into it in more detail, it may be a PHP7 issue.
In this style of code $args may be undefined atreturn $args;since it is only referenced inside the conditional statements:// Change separator of subforums and remove topic and reply count function bbptoolkit_bbpress_list_forums() { $bbptoolkit_subforum_separator = get_option('bbptoolkit-subforum-separator', false); if ($bbptoolkit_subforum_separator) { $args['separator'] = $bbptoolkit_subforum_separator; } $bbptoolkit_subforum_hide_counters = get_option('bbptoolkit-subforum-hide-counters', false); if ($bbptoolkit_subforum_hide_counters) { $args['show_topic_count'] = false; $args['show_reply_count'] = false; } return $args; } add_filter('bbp_after_list_forums_parse_args', 'bbptoolkit_bbpress_list_forums' );Doing it again on local environment for debug information, first error is:
Notice: Undefined variable: args in wp-content/plugins/bbp-toolkit/includes/go-functions.php on line 65
Stack trace:
1. {main}() index.php:0
2. require() index.php:17
3. require_once() wp-blog-header.php:19
4. apply_filters($tag = *uninitialized*, $value = *uninitialized*) wp-includes/template-loader.php:73
5. WP_Hook->apply_filters($value = *uninitialized*, $args = *uninitialized*) wp-includes/plugin.php:203
6. bbp_template_include($template = *uninitialized*) wp-includes/class-wp-hook.php:298
7. apply_filters($tag = *uninitialized*, $value = *uninitialized*) wp-content/plugins/bbpress/includes/core/sub-actions.php:502
8. WP_Hook->apply_filters($value = *uninitialized*, $args = *uninitialized*) wp-includes/plugin.php:203
9. bbp_template_include_theme_compat($template = *uninitialized*) wp-includes/class-wp-hook.php:298
10. BBP_Shortcodes->display_forum_index() wp-content/plugins/bbpress/includes/core/theme-compat.php:536
11. bbp_get_template_part($slug = *uninitialized*, $name = *uninitialized*) wp-content/plugins/bbpress/includes/common/shortcodes.php:210
12. bbp_locate_template($template_names = *uninitialized*, $load = *uninitialized*, $require_once = *uninitialized*) wp-content/plugins/bbpress/includes/core/template-functions.php:44
13. load_template($_template_file = *uninitialized*, $require_once = *uninitialized*) wp-content/plugins/bbpress/includes/core/template-functions.php:106
14. require() wp-includes/template.php:690
15. bbp_get_template_part($slug = *uninitialized*, $name = *uninitialized*) wp-content/plugins/bbpress/templates/default/bbpress/content-archive-forum.php:35
16. bbp_locate_template($template_names = *uninitialized*, $load = *uninitialized*, $require_once = *uninitialized*) wp-content/plugins/bbpress/includes/core/template-functions.php:44
17. load_template($_template_file = *uninitialized*, $require_once = *uninitialized*) wp-content/plugins/bbpress/includes/core/template-functions.php:106
18. require() wp-includes/template.php:690
19. bbp_get_template_part($slug = *uninitialized*, $name = *uninitialized*) wp-content/plugins/bbpress/templates/default/bbpress/loop-forums.php:35
20. bbp_locate_template($template_names = *uninitialized*, $load = *uninitialized*, $require_once = *uninitialized*) wp-content/plugins/bbpress/includes/core/template-functions.php:44
21. load_template($_template_file = *uninitialized*, $require_once = *uninitialized*) wp-content/plugins/bbpress/includes/core/template-functions.php:106
22. require() wp-includes/template.php:690
23. bbp_list_forums($args = *uninitialized*) wp-content/plugins/bbpress/templates/default/bbpress/loop-single-forum.php:46
24. bbp_parse_args($args = *uninitialized*, $defaults = *uninitialized*, $filter_key = *uninitialized*) wp-content/plugins/bbpress/includes/forums/template.php:816
25. apply_filters($tag = *uninitialized*, $value = *uninitialized*) wp-content/plugins/bbpress/includes/common/functions.php:1457
26. WP_Hook->apply_filters($value = *uninitialized*, $args = *uninitialized*) wp-includes/plugin.php:203
27. bbptoolkit_bbpress_list_forums(*uninitialized*) wp-includes/class-wp-hook.php:298That’s the first error which is indeed resolved by saving settings.
and then moved to next error:Notice: Undefined index: forum_id in wp-content/plugins/bbpress/includes/forums/template.php on line 819 Stack trace: 1. {main}() index.php:0 2. require() index.php:17 3. require_once() wp-blog-header.php:19 4. apply_filters($tag = *uninitialized*, $value = *uninitialized*) wp-includes/template-loader.php:73 5. WP_Hook->apply_filters($value = *uninitialized*, $args = *uninitialized*) wp-includes/plugin.php:203 6. bbp_template_include($template = *uninitialized*) wp-includes/class-wp-hook.php:298 7. apply_filters($tag = *uninitialized*, $value = *uninitialized*) wp-content/plugins/bbpress/includes/core/sub-actions.php:502 8. WP_Hook->apply_filters($value = *uninitialized*, $args = *uninitialized*) wp-includes/plugin.php:203 9. bbp_template_include_theme_compat($template = *uninitialized*) wp-includes/class-wp-hook.php:298 10. BBP_Shortcodes->display_forum_index() wp-content/plugins/bbpress/includes/core/theme-compat.php:536 11. bbp_get_template_part($slug = *uninitialized*, $name = *uninitialized*) wp-content/plugins/bbpress/includes/common/shortcodes.php:210 12. bbp_locate_template($template_names = *uninitialized*, $load = *uninitialized*, $require_once = *uninitialized*) wp-content/plugins/bbpress/includes/core/template-functions.php:44 13. load_template($_template_file = *uninitialized*, $require_once = *uninitialized*) wp-content/plugins/bbpress/includes/core/template-functions.php:106 14. require() wp-includes/template.php:690 15. bbp_get_template_part($slug = *uninitialized*, $name = *uninitialized*) wp-content/plugins/bbpress/templates/default/bbpress/content-archive-forum.php:35 16. bbp_locate_template($template_names = *uninitialized*, $load = *uninitialized*, $require_once = *uninitialized*) wp-content/plugins/bbpress/includes/core/template-functions.php:44 17. load_template($_template_file = *uninitialized*, $require_once = *uninitialized*) wp-content/plugins/bbpress/includes/core/template-functions.php:106 18. require() wp-includes/template.php:690 19. bbp_get_template_part($slug = *uninitialized*, $name = *uninitialized*) wp-content/plugins/bbpress/templates/default/bbpress/loop-forums.php:35 20. bbp_locate_template($template_names = *uninitialized*, $load = *uninitialized*, $require_once = *uninitialized*) wp-content/plugins/bbpress/includes/core/template-functions.php:44 21. load_template($_template_file = *uninitialized*, $require_once = *uninitialized*) wp-content/plugins/bbpress/includes/core/template-functions.php:106 22. require() wp-includes/template.php:690 23. bbp_list_forums($args = *uninitialized*) wp-content/plugins/bbpress/templates/default/bbpress/loop-single-forum.php:46initially mystifying, this error can be resolved by commenting out these lines in go-functions.php ll54-66:
// Change separator of subforums and remove topic and reply count function bbptoolkit_bbpress_list_forums() { $bbptoolkit_subforum_separator = get_option('bbptoolkit-subforum-separator', false); if ($bbptoolkit_subforum_separator) { $args['separator'] = $bbptoolkit_subforum_separator; } $bbptoolkit_subforum_hide_counters = get_option('bbptoolkit-subforum-hide-counters', false); if ($bbptoolkit_subforum_hide_counters) { $args['show_topic_count'] = false; $args['show_reply_count'] = false; } return $args; } //add_filter('bbp_after_list_forums_parse_args', 'bbptoolkit_bbpress_list_forums' );This code under php7 is causing the args to be reset.
The topic ‘Undefined errors on initial install’ is closed to new replies.