Home › Forums › WoodMart support forum › Fatal error in whislist
Fatal error in whislist
- This topic has 8 replies, 2 voices, and was last updated 1 year, 10 months ago by Artem Temos.
-
AuthorPosts
-
January 6, 2023 at 1:40 pm #433573
metuzaParticipantHello,
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 UPDATEwp_woodmart_wishlist_products
SETon_sale
= ‘1’ WHEREproduct_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 UPDATEwp_woodmart_wishlist_products
SETon_sale
= ‘1’ WHEREproduct_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 UPDATEwp_woodmart_wishlist_products
SETon_sale
= ‘1’ WHEREproduct_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 UPDATEwp_woodmart_wishlist_products
SETon_sale
= ‘1’ WHEREproduct_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 UPDATEwp_woodmart_wishlist_products
SETon_sale
= ‘1’ WHEREproduct_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 UPDATEwp_woodmart_wishlist_products
SETon_sale
= ‘1’ WHEREproduct_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 UPDATEwp_woodmart_wishlist_products
SETon_sale
= ‘1’ WHEREproduct_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 101Brgds
RuneJanuary 6, 2023 at 3:05 pm #433586
Artem TemosKeymasterHello,
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
January 6, 2023 at 7:52 pm #433669
metuzaParticipantHello,
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 101The same happends on both my site. I have added admin access for you.
Brgds
Rune- This reply was modified 1 year, 10 months ago by metuza.
January 6, 2023 at 8:13 pm #433671
metuzaParticipantHello 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
RuneJanuary 9, 2023 at 11:11 am #433919
Artem TemosKeymasterHello,
We have fixed the error on your website. Please, test how it works and let us know if it appears again.
Kind Regards
January 9, 2023 at 9:34 pm #434035
metuzaParticipantHello 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 UPDATEwp_woodmart_wishlist_products
SETon_sale
= ‘1’ WHEREproduct_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_productAtleast emails was sent about on sale products in wishlist, and no fatal errors.
Brgds
RuneJanuary 9, 2023 at 10:02 pm #434036
metuzaParticipantOk, 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
RuneJanuary 9, 2023 at 10:23 pm #434041
metuzaParticipantOk, 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
RuneJanuary 10, 2023 at 11:12 am #434130
Artem TemosKeymasterHello,
Thank you for sharing this information. We will add the fix in our next theme update also.
Kind Regards
-
AuthorPosts
- You must be logged in to create new topics. Login / Register