Home Forums WoodMart support forum Fatal error in whislist

Fatal error in whislist

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #433573

    metuza
    Participant

    Hello,

    Now and then i get the below error in my logs on both my websites:

    [05-Jan-2023 17:25:03 UTC] WordPress database error Unknown column ‘on_sale’ in ‘where clause’ for query SELECT product_id FROM wp_woodmart_wishlist_products WHERE on_sale = 1 made by include(‘phar:///usr/local/bin/wp/php/boot-phar.php’), include(‘phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/wp-cli.php’), WP_CLI\bootstrap, WP_CLI\Bootstrap\LaunchRunner->process, WP_CLI\Runner->start, WP_CLI\Runner->run_command_and_exit, WP_CLI\Runner->run_command, WP_CLI\Dispatcher\Subcommand->invoke, call_user_func, WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher\{closure}, call_user_func, Cron_Event_Command->run, Cron_Event_Command::run_event, do_action_ref_array(‘woodmart_wishlist_register_on_sales_products’), WP_Hook->do_action, WP_Hook->apply_filters, XTS\WC_Wishlist\Send_On_Sales_Products->register_on_sales_products, XTS\WC_Wishlist\Send_On_Sales_Products->get_product_id_which_on_sale
    [05-Jan-2023 17:25:03 UTC] WordPress database error Unknown column ‘on_sale’ in ‘field list’ for query UPDATE wp_woodmart_wishlist_products SET on_sale = ‘1’ WHERE product_id = ’69’ made by include(‘phar:///usr/local/bin/wp/php/boot-phar.php’), include(‘phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/wp-cli.php’), WP_CLI\bootstrap, WP_CLI\Bootstrap\LaunchRunner->process, WP_CLI\Runner->start, WP_CLI\Runner->run_command_and_exit, WP_CLI\Runner->run_command, WP_CLI\Dispatcher\Subcommand->invoke, call_user_func, WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher\{closure}, call_user_func, Cron_Event_Command->run, Cron_Event_Command::run_event, do_action_ref_array(‘woodmart_wishlist_register_on_sales_products’), WP_Hook->do_action, WP_Hook->apply_filters, XTS\WC_Wishlist\Send_On_Sales_Products->register_on_sales_products, XTS\WC_Wishlist\Send_On_Sales_Products->update_on_sale_for_product
    [05-Jan-2023 17:25:03 UTC] WordPress database error Unknown column ‘on_sale’ in ‘field list’ for query UPDATE wp_woodmart_wishlist_products SET on_sale = ‘1’ WHERE product_id = ‘302’ made by include(‘phar:///usr/local/bin/wp/php/boot-phar.php’), include(‘phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/wp-cli.php’), WP_CLI\bootstrap, WP_CLI\Bootstrap\LaunchRunner->process, WP_CLI\Runner->start, WP_CLI\Runner->run_command_and_exit, WP_CLI\Runner->run_command, WP_CLI\Dispatcher\Subcommand->invoke, call_user_func, WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher\{closure}, call_user_func, Cron_Event_Command->run, Cron_Event_Command::run_event, do_action_ref_array(‘woodmart_wishlist_register_on_sales_products’), WP_Hook->do_action, WP_Hook->apply_filters, XTS\WC_Wishlist\Send_On_Sales_Products->register_on_sales_products, XTS\WC_Wishlist\Send_On_Sales_Products->update_on_sale_for_product
    [05-Jan-2023 17:25:03 UTC] WordPress database error Unknown column ‘on_sale’ in ‘field list’ for query UPDATE wp_woodmart_wishlist_products SET on_sale = ‘1’ WHERE product_id = ‘334’ made by include(‘phar:///usr/local/bin/wp/php/boot-phar.php’), include(‘phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/wp-cli.php’), WP_CLI\bootstrap, WP_CLI\Bootstrap\LaunchRunner->process, WP_CLI\Runner->start, WP_CLI\Runner->run_command_and_exit, WP_CLI\Runner->run_command, WP_CLI\Dispatcher\Subcommand->invoke, call_user_func, WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher\{closure}, call_user_func, Cron_Event_Command->run, Cron_Event_Command::run_event, do_action_ref_array(‘woodmart_wishlist_register_on_sales_products’), WP_Hook->do_action, WP_Hook->apply_filters, XTS\WC_Wishlist\Send_On_Sales_Products->register_on_sales_products, XTS\WC_Wishlist\Send_On_Sales_Products->update_on_sale_for_product
    [05-Jan-2023 17:25:03 UTC] WordPress database error Unknown column ‘on_sale’ in ‘field list’ for query UPDATE wp_woodmart_wishlist_products SET on_sale = ‘1’ WHERE product_id = ‘336’ made by include(‘phar:///usr/local/bin/wp/php/boot-phar.php’), include(‘phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/wp-cli.php’), WP_CLI\bootstrap, WP_CLI\Bootstrap\LaunchRunner->process, WP_CLI\Runner->start, WP_CLI\Runner->run_command_and_exit, WP_CLI\Runner->run_command, WP_CLI\Dispatcher\Subcommand->invoke, call_user_func, WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher\{closure}, call_user_func, Cron_Event_Command->run, Cron_Event_Command::run_event, do_action_ref_array(‘woodmart_wishlist_register_on_sales_products’), WP_Hook->do_action, WP_Hook->apply_filters, XTS\WC_Wishlist\Send_On_Sales_Products->register_on_sales_products, XTS\WC_Wishlist\Send_On_Sales_Products->update_on_sale_for_product
    [05-Jan-2023 17:25:03 UTC] WordPress database error Unknown column ‘on_sale’ in ‘field list’ for query UPDATE wp_woodmart_wishlist_products SET on_sale = ‘1’ WHERE product_id = ‘337’ made by include(‘phar:///usr/local/bin/wp/php/boot-phar.php’), include(‘phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/wp-cli.php’), WP_CLI\bootstrap, WP_CLI\Bootstrap\LaunchRunner->process, WP_CLI\Runner->start, WP_CLI\Runner->run_command_and_exit, WP_CLI\Runner->run_command, WP_CLI\Dispatcher\Subcommand->invoke, call_user_func, WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher\{closure}, call_user_func, Cron_Event_Command->run, Cron_Event_Command::run_event, do_action_ref_array(‘woodmart_wishlist_register_on_sales_products’), WP_Hook->do_action, WP_Hook->apply_filters, XTS\WC_Wishlist\Send_On_Sales_Products->register_on_sales_products, XTS\WC_Wishlist\Send_On_Sales_Products->update_on_sale_for_product
    [05-Jan-2023 17:25:03 UTC] WordPress database error Unknown column ‘on_sale’ in ‘field list’ for query UPDATE wp_woodmart_wishlist_products SET on_sale = ‘1’ WHERE product_id = ‘339’ made by include(‘phar:///usr/local/bin/wp/php/boot-phar.php’), include(‘phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/wp-cli.php’), WP_CLI\bootstrap, WP_CLI\Bootstrap\LaunchRunner->process, WP_CLI\Runner->start, WP_CLI\Runner->run_command_and_exit, WP_CLI\Runner->run_command, WP_CLI\Dispatcher\Subcommand->invoke, call_user_func, WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher\{closure}, call_user_func, Cron_Event_Command->run, Cron_Event_Command::run_event, do_action_ref_array(‘woodmart_wishlist_register_on_sales_products’), WP_Hook->do_action, WP_Hook->apply_filters, XTS\WC_Wishlist\Send_On_Sales_Products->register_on_sales_products, XTS\WC_Wishlist\Send_On_Sales_Products->update_on_sale_for_product
    [05-Jan-2023 17:25:03 UTC] WordPress database error Unknown column ‘on_sale’ in ‘field list’ for query UPDATE wp_woodmart_wishlist_products SET on_sale = ‘1’ WHERE product_id = ‘378’ made by include(‘phar:///usr/local/bin/wp/php/boot-phar.php’), include(‘phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/wp-cli.php’), WP_CLI\bootstrap, WP_CLI\Bootstrap\LaunchRunner->process, WP_CLI\Runner->start, WP_CLI\Runner->run_command_and_exit, WP_CLI\Runner->run_command, WP_CLI\Dispatcher\Subcommand->invoke, call_user_func, WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher\{closure}, call_user_func, Cron_Event_Command->run, Cron_Event_Command::run_event, do_action_ref_array(‘woodmart_wishlist_register_on_sales_products’), WP_Hook->do_action, WP_Hook->apply_filters, XTS\WC_Wishlist\Send_On_Sales_Products->register_on_sales_products, XTS\WC_Wishlist\Send_On_Sales_Products->update_on_sale_for_product
    [05-Jan-2023 17:25:03 UTC] PHP Warning: Undefined array key 1 in /public/wp-content/themes/woodmart/inc/integrations/woocommerce/modules/wishlist/sends-about-products-wishlist/class-send-on-sales-products.php on line 101
    [05-Jan-2023 17:25:03 UTC] PHP Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /public/wp-content/themes/woodmart/inc/integrations/woocommerce/modules/wishlist/sends-about-products-wishlist/class-send-on-sales-products.php:101
    Stack trace:
    #0 /public/wp-content/themes/woodmart/inc/integrations/woocommerce/modules/wishlist/sends-about-products-wishlist/class-send-on-sales-products.php(101): in_array()
    #1 /public/wp-includes/class-wp-hook.php(308): XTS\WC_Wishlist\Send_On_Sales_Products->register_on_sales_products()
    #2 /public/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters()
    #3 /public/wp-includes/plugin.php(565): WP_Hook->do_action()
    #4 phar:///usr/local/bin/wp/vendor/wp-cli/cron-command/src/Cron_Event_Command.php(343): do_action_ref_array()
    #5 phar:///usr/local/bin/wp/vendor/wp-cli/cron-command/src/Cron_Event_Command.php(265): Cron_Event_Command::run_event()
    #6 [internal function]: Cron_Event_Command->run()
    #7 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CommandFactory.php(100): call_user_func()
    #8 [internal function]: WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher\{closure}()
    #9 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/Subcommand.php(491): call_user_func()
    #10 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(419): WP_CLI\Dispatcher\Subcommand->invoke()
    #11 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(442): WP_CLI\Runner->run_command()
    #12 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1256): WP_CLI\Runner->run_command_and_exit()
    #13 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php(28): WP_CLI\Runner->start()
    #14 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/bootstrap.php(78): WP_CLI\Bootstrap\LaunchRunner->process()
    #15 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/wp-cli.php(32): WP_CLI\bootstrap()
    #16 phar:///usr/local/bin/wp/php/boot-phar.php(11): include(‘…’)
    #17 /usr/local/bin/wp(4): include(‘…’)
    #18 {main}
    thrown in /public/wp-content/themes/woodmart/inc/integrations/woocommerce/modules/wishlist/sends-about-products-wishlist/class-send-on-sales-products.php on line 101

    Brgds
    Rune

    #433586

    Artem Temos
    Keymaster

    Hello,

    Please, send us your admin and FTP access and describe how to reproduce the error. We will test this and fix it on your website.

    Kind Regards

    #433669

    metuza
    Participant

    Hello,

    I can not say what actions leads to these errors and the fatal error as they appear in log just now and then. But it seems to me that it is related to a cron job so i did now a test and run the cron job “woodmart_wishlist_register_on_sales_products” in which gave me the below error:

    2023-01-06T16:44:39+00:00 CRITICAL Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /wp-content/themes/woodmart/inc/integrations/woocommerce/modules/wishlist/sends-about-products-wishlist/class-send-on-sales-products.php:101
    Stack trace:
    #0 /wp-content/themes/woodmart/inc/integrations/woocommerce/modules/wishlist/sends-about-products-wishlist/class-send-on-sales-products.php(101): in_array(Array, NULL, true)
    #1 /public/wp-includes/class-wp-hook.php(308): XTS\WC_Wishlist\Send_On_Sales_Products->register_on_sales_products()
    #2 /public/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters(”, Array)
    #3 /public/wp-includes/plugin.php(565): WP_Hook->do_action(Array)
    #4 /public/wp-cron.php(188): do_action_ref_array(‘woodmart_wishli…’, Array)
    #5 {main}
    thrown i /wp-content/themes/woodmart/inc/integrations/woocommerce/modules/wishlist/sends-about-products-wishlist/class-send-on-sales-products.php på linje 101

    The same happends on both my site. I have added admin access for you.

    Brgds
    Rune

    • This reply was modified 1 year, 3 months ago by metuza.
    #433671

    metuza
    Participant

    Hello again,

    I just found that i have posted about this problem once before as i saw my test code commented out in problem file line 1.

    When i now checked option “woodmart_wishlist_products_on_sale” in database it had a value of: a:0:{}

    Then in the problem file line 101 i did replace this line:
    if ( in_array( get_userdata( $user_id )->user_email, $unsubscribed_users, true ) || in_array( $products_on_sales, $products_on_sales[ $user_id ], true ) ) {

    with this modified line:
    if ( in_array( get_userdata( $user_id )->user_email, $unsubscribed_users, true ) || in_array( $products_on_sales[ $user_id ], $products_on_sales, true ) ) {

    Now the value is like this in database: a:2:{i:1;a:1:{i:0;i:378;}i:2;a:1:{i:0;i:2135;}}
    And no fatal errors was found.

    Then i swithed back the code change to orginal:
    if ( in_array( get_userdata( $user_id )->user_email, $unsubscribed_users, true ) || in_array( $products_on_sales, $products_on_sales[ $user_id ], true ) ) {

    Started the cron job again and got this db value with no errors:
    a:2:{i:1;a:7:{i:0;i:378;i:1;i:378;i:2;i:708;i:3;i:1862;i:4;i:2039;i:5;i:2530;i:6;i:2534;}i:2;a:2:{i:0;i:2135;i:1;i:2135;}}

    So it seems like the value a:0:{} given in option “woodmart_wishlist_products_on_sale” is not accepted as an array, and then the error appear.

    Brgds
    Rune

    #433919

    Artem Temos
    Keymaster

    Hello,

    We have fixed the error on your website. Please, test how it works and let us know if it appears again.

    Kind Regards

    #434035

    metuza
    Participant

    Hello again,

    Thanks..

    The cronjob did run just now and then i did find several of these database errors:

    [09-Jan-2023 17:25:02 UTC] PHP Notice: Funksjonen wpdb::prepare ble kalt feil. Søkeargumentet wpdb::prepare() må ha en plassholder. Vennligst se Feilsøking i WordPress for mer informasjon. (Denne meldingen ble lagt i versjon 3.9.0.) in /public/wp-includes/functions.php on line 5835
    [09-Jan-2023 17:25:02 UTC] WordPress database error Unknown column ‘on_sale’ in ‘where clause’ for query SELECT product_id FROM wp_woodmart_wishlist_products WHERE on_sale = 1 made by include(‘phar:///usr/local/bin/wp/php/boot-phar.php’), include(‘phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/wp-cli.php’), WP_CLI\bootstrap, WP_CLI\Bootstrap\LaunchRunner->process, WP_CLI\Runner->start, WP_CLI\Runner->run_command_and_exit, WP_CLI\Runner->run_command, WP_CLI\Dispatcher\Subcommand->invoke, call_user_func, WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher\{closure}, call_user_func, Cron_Event_Command->run, Cron_Event_Command::run_event, do_action_ref_array(‘woodmart_wishlist_register_on_sales_products’), WP_Hook->do_action, WP_Hook->apply_filters, XTS\WC_Wishlist\Send_On_Sales_Products->register_on_sales_products, XTS\WC_Wishlist\Send_On_Sales_Products->get_product_id_which_on_sale
    [09-Jan-2023 17:25:02 UTC] WordPress database error Unknown column ‘on_sale’ in ‘field list’ for query UPDATE wp_woodmart_wishlist_products SET on_sale = ‘1’ WHERE product_id = ’69’ made by include(‘phar:///usr/local/bin/wp/php/boot-phar.php’), include(‘phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/wp-cli.php’), WP_CLI\bootstrap, WP_CLI\Bootstrap\LaunchRunner->process, WP_CLI\Runner->start, WP_CLI\Runner->run_command_and_exit, WP_CLI\Runner->run_command, WP_CLI\Dispatcher\Subcommand->invoke, call_user_func, WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher\{closure}, call_user_func, Cron_Event_Command->run, Cron_Event_Command::run_event, do_action_ref_array(‘woodmart_wishlist_register_on_sales_products’), WP_Hook->do_action, WP_Hook->apply_filters, XTS\WC_Wishlist\Send_On_Sales_Products->register_on_sales_products, XTS\WC_Wishlist\Send_On_Sales_Products->update_on_sale_for_product

    Atleast emails was sent about on sale products in wishlist, and no fatal errors.

    Brgds
    Rune

    #434036

    metuza
    Participant

    Ok, i did find that the column “on_sale” was missing in DB, it is not created in both my sites. So i have now created the column and ran a cronjob and so far it seems like all warnings has gone except from this one:

    [09-Jan-2023 18:58:42 UTC] PHP Notice: Funksjonen wpdb::prepare ble kalt feil. Søkeargumentet wpdb::prepare() må ha en plassholder. Vennligst se Feilsøking i WordPress for mer informasjon. (Denne meldingen ble lagt i versjon 3.9.0.) in /www/villmarksbua_243/public/wp-includes/functions.php on line 5835

    Brgds
    Rune

    #434041

    metuza
    Participant

    Ok, the last warning was found in /wp-content/themes/woodmart/inc/integrations/woocommerce/modules/wishlist/sends-about-products-wishlist/class-send-on-sales-products.php

    public function get_product_id_which_on_sale() {
    global $wpdb;

    return $wpdb->get_col(
    $wpdb->prepare(
    “SELECT product_id FROM $wpdb->woodmart_products_table WHERE on_sale = %d“,
    1
    )
    );
    }

    Added the placeholder and all warnings is gone.

    Brgds
    Rune

    #434130

    Artem Temos
    Keymaster

    Hello,

    Thank you for sharing this information. We will add the fix in our next theme update also.

    Kind Regards

Viewing 9 posts - 1 through 9 (of 9 total)