Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting a critical error on the "Multipliers" & "Per Product" tabs from our plugin. #35

Closed
priyanka-tychesoftwares opened this issue Sep 26, 2022 · 0 comments
Assignees
Milestone

Comments

@priyanka-tychesoftwares
Copy link

priyanka-tychesoftwares commented Sep 26, 2022

Describe the bug
Getting the below critical error on the "Multipliers" & "Per Product" tabs from our plugin.

To Reproduce
Steps to reproduce the behavior:
WordPress & WooCommerce version are latest.
PHP version 8.0.23 is present on the client site.

  1. Go to the "Multipliers" & "Per Product" tabs of our plugin and you will get a message "There has been a critical error on this website. Please check your site admin email inbox for instructions." there.
  2. This error is coming at WC -> Status -> Logs
    [21-Sep-2022 07:06:03 UTC] PHP Fatal error: Uncaught TypeError: Cannot access offset of type string on string in /is/htdocs/wp12357911_HH4C4GMTV8/www/shop.nospamproxy.de/testshop-nsp/wp-content/plugins/price-by-user-role-for-woocommerce/includes/settings/class-alg-wc-price-by-user-role-settings-multipliers.php:84
    Stack trace:
    #0 /is/htdocs/wp12357911_HH4C4GMTV8/www/shop.nospamproxy.de/testshop-nsp/wp-content/plugins/price-by-user-role-for-woocommerce/includes/settings/class-alg-wc-price-by-user-role-settings-section.php(57): Alg_WC_Price_By_User_Role_Settings_Multipliers->get_section_settings()
    The 'Price by User Role' fields should be shown using the Ajax when the 'Enabled' dropdown is set to 'Yes' otherwise hidden. #1 /is/htdocs/wp12357911_HH4C4GMTV8/www/shop.nospamproxy.de/testshop-nsp/wp-includes/class-wp-hook.php(307): Alg_WC_Price_By_User_Role_Settings_Section->get_settings(Array)
    Plugin does not clean up its records when deleted #2 /is/htdocs/wp12357911_HH4C4GMTV8/www/shop.nospamproxy.de/testshop-nsp/wp-includes/plugin.php(191): WP_Hook->apply_filters(Array, Array)
    Fix 1.3 #3 /is/htdocs/wp12357911_HH4C4GMTV8/www/shop.nospamproxy.de/testshop-nsp/wp-content/plugins/price-by-user-role-for-woocommerce/includes/settings/class-alg-wc-settings-price-by-user-role.php(45): apply_filters('woocommerce_get...', Array)
    Fix #1 #4 /is/htdocs/wp12357911_HH4C4GMTV8/www/shop.nospamproxy.de/testshop-nsp/wp-content/plugins/woocommerce/includes/admin/settings/class-wc-settings-page.php(211): Alg_WC_Settings_Price_By_User_Role->get_settings('multipliers')
    Version 1.3 #5 /is/htdocs/wp12357911_HH4C4GMTV8/www/shop.nospamproxy.de/testshop-nsp/wp-includes/class-wp-hook.php(307): WC_Settings_Page->output('')
    Able to allow the shop manager user role to edit the prices for all the user role. #6 /is/htdocs/wp12357911_HH4C4GMTV8/www/shop.nospamproxy.de/testshop-nsp/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters('', Array)
    PHP CodeSniffer #7 /is/htdocs/wp12357911_HH4C4GMTV8/www/shop.nospamproxy.de/testshop-nsp/wp-includes/plugin.php(476): WP_Hook->do_action(Array)
    Correcting files as per phpcs #8 /is/htdocs/wp12357911_HH4C4GMTV8/www/shop.nospamproxy.de/testshop-nsp/wp-content/plugins/woocommerce/includes/admin/views/html-admin-settings.php(40): do_action('woocommerce_set...')
    Changes as per phpcs #9 /is/htdocs/wp12357911_HH4C4GMTV8/www/shop.nospamproxy.de/testshop-nsp/wp-content/plugins/woocommerce/includes/admin/class-wc-admin-settings.php(154): include('/is/htdocs/wp12...')
    Html is being displayed instead of link #10 /is/htdocs/wp12357911_HH4C4GMTV8/www/shop.nospamproxy.de/testshop-nsp/wp-content/plugins/woocommerce/includes/admin/class-wc-admin-menus.php(286): WC_Admin_Settings::output()
    fix #10 #11 /is/htdocs/wp12357911_HH4C4GMTV8/www/shop.nospamproxy.de/testshop-nsp/wp-includes/class-wp-hook.php(307): WC_Admin_Menus->settings_page('')
    PHPCS strict comparison #12 /is/htdocs/wp12357911_HH4C4GMTV8/www/shop.nospamproxy.de/testshop-nsp/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters('', Array)
    Added UTM param #13 /is/htdocs/wp12357911_HH4C4GMTV8/www/shop.nospamproxy.de/testshop-nsp/wp-includes/plugin.php(476): WP_Hook->do_action(Array)
    Updated stable tag, tags & UTM tags #14 /is/htdocs/wp12357911_HH4C4GMTV8/www/shop.nospamproxy.de/testshop-nsp/wp-admin/admin.php(259): do_action('woocommerce_pag...')
    Price filtering is not working when different price is set for the different user roles. #15 {main}
    thrown in /is/htdocs/wp12357911_HH4C4GMTV8/www/shop.nospamproxy.de/testshop-nsp/wp-content/plugins/price-by-user-role-for-woocommerce/includes/settings/class-alg-wc-price-by-user-role-settings-multipliers.php on line 84

NOTE: I tried to replicate this error on my local where the PHP 8.0.0 is present but I am unable to replicate this error there.

Expected behavior
Such an error should not appear from our plugin.

Screenshots
https://www.screencast.com/t/3UcrRhT5R

Additional context
https://tychesoftwares.freshdesk.com/a/tickets/44811

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants
@kartikparmar @apeksha10 @priyanka-tychesoftwares and others