Critical bug report & fix: Admin UI render has a bug
-
Hi,
you have bug in admin UI rendering. You are not checking that the dictionary value exists before using it -> crash the page rendering.
WHEN THIS HAPPENS
In my multisite WP right after installing and going to settings. It shows first settings and crashes on “Exclude rating and result widget from:”
REASON OF CRASHING:
When as a new plugin there are no option data, you try to echo data that does not exists.
ERROR LOG
[Thu Oct 03 06:38:42.448649 2024] [php:error] [pid 67057] [client 87.92.171.122:59834] PHP Fatal error:? Uncaught TypeError: implode(): Argument #1 ($pieces) must be of type array, string given in /var/www/html/wp-content/plugins/rate-my-post/admin/templates/menu-options.php:312\nStack trace:\n#0 /var/www/html/wp-content/plugins/rate-my-post/admin/templates/menu-options.php(312): implode()\n#1 /var/www/html/wp-content/plugins/rate-my-post/admin/templates/menu.php(59): include_once(‘…’)\n#2 /var/www/html/wp-content/plugins/rate-my-post/admin/class-rate-my-post-admin.php(493): include_once(‘…’)\n#3 /var/www/html/wp-includes/class-wp-hook.php(324): Rate_My_Post_Admin->menu_section_display()\n#4 /var/www/html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()\n#5 /var/www/html/wp-includes/plugin.php(517): WP_Hook->do_action()\n#6 /var/www/html/wp-admin/admin.php(259): do_action()\n#7 {main}\n? thrown in /var/www/html/wp-content/plugins/rate-my-post/admin/templates/menu-options.php on line 312, referer: https://uni.uniwaves.com/innoduel/wp-admin/
HOW TO FIX THE ERROR
Update the line 312 in file /var/www/html/wp-content/plugins/rate-my-post/admin/templates/menu-options.php as below:
<input type="text" class="rmp-tab-content__input js-rmp-option" data-key="exclude" id="rmp-exclude" value="<?php echo esc_html(implode(',', $rmp_options['exclude'])); ?>">
->
<input type="text" class="rmp-tab-content__input js-rmp-option" data-key="exclude" id="rmp-exclude" value="<?php if(isset($rmp_options['exclude'])) echo esc_html(implode(',', $rmp_options['exclude'])); ?>">
- You must be logged in to reply to this topic.