Title: MySQL warnings from helper-function.php code
Last modified: October 21, 2024

---

# MySQL warnings from helper-function.php code

 *  Resolved [CrazySerb](https://wordpress.org/support/users/crazyserb/)
 * (@crazyserb)
 * [1 year, 7 months ago](https://wordpress.org/support/topic/mysql-warnings-from-helper-function-php-code/)
 * We’ve been seeing so many warnings, like thousands per second, being generated
   in our mySQL error logs, all based off of this code:
   [https://prnt.sc/PyQWtBs0rJ8T](https://prnt.sc/PyQWtBs0rJ8T)
 * and they end up filling up our logs constantly with errors like this (like millions
   of these per hour):
   `2024-10-20 20:52:13 user @ localhost [] WARNING 1292: Truncated
   incorrect INTEGER value: '9320.98' : SELECT MAX( CAST( meta_value as UNSIGNED))
   FROM wp_postmeta WHERE meta_key = '_price' `
 * as well as these ones:
   `2024-10-20 20:52:12 user @ localhost [] WARNING 1292:
   Truncated incorrect INTEGER value: '7999.99' : SELECT SQL_CALC_FOUND_ROWS wp_posts.
   IDFROM wp_posts LEFT JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.
   object_id) LEFT JOIN wp_term_relationships AS tt1 ON (wp_posts.ID = tt1.object_id)
   LEFT JOIN wp_term_relationships AS tt2 ON (wp_posts.ID = tt2.object_id) INNER
   JOIN wp_postmeta ON ( wp_posts.ID = wp_postmeta.post_id ) INNER JOIN wp_postmeta
   AS mt1 ON ( wp_posts.ID = mt1.post_id ) LEFT JOIN wp_wc_product_meta_lookup wc_product_meta_lookup
   ON wp_posts.ID = wc_product_meta_lookup.product_idWHERE 1=1 AND (wp_posts.ID 
   NOT IN (SELECT object_idFROM wp_term_relationshipsWHERE term_taxonomy_id IN (
   5530,5535))ANDwp_term_relationships.term_taxonomy_id IN (3759,9380,13420,13421,13422,13423,13424)
   ANDwp_posts.ID NOT IN (SELECT object_idFROM wp_term_relationshipsWHERE term_taxonomy_id
   IN (5530,5535))
 * The moment we turn that plugin off, these issues go away and the server load 
   eases up a bit.
 * The minute we turn the plugin back on, the server load spikes up and the error
   log ends up being overfilled with these warnings in no time.
 * Might wanna look into this code and fix things up a bit.

Viewing 11 replies - 1 through 11 (of 11 total)

 *  [Tarek Aziz](https://wordpress.org/support/users/tarekht/)
 * (@tarekht)
 * [1 year, 7 months ago](https://wordpress.org/support/topic/mysql-warnings-from-helper-function-php-code/#post-18084748)
 * Hello [@crazyserb](https://wordpress.org/support/users/crazyserb/),
 * Thank you very much for reaching out to us.
 * I am sorry to hear about the warnings you have encountered after installing the
   plugin.
 * After carefully reviewing your message and screenshot, the issue you are facing
   seems unsusal.
 * With all due respect, it’s unlikely that ShopLentor will cause such an issue.
   There may be a conflict with a third-party plugin on your website.
 * However, we’ll definitely investigate the plugin further and address any such
   issues we come across during our investigation.
 * Thank you once again for bringing this to our attention.
 * Wishing you a wonderful day ahead!
 * Best regards,
    Tarek Aziz
 *  Thread Starter [CrazySerb](https://wordpress.org/support/users/crazyserb/)
 * (@crazyserb)
 * [1 year, 7 months ago](https://wordpress.org/support/topic/mysql-warnings-from-helper-function-php-code/#post-18084943)
 * Well, whether that’s a conflict with another plugin (maybe Elementor / Elementor
   Pro or Rank Math / Rank Math Pro?) or not, it’s somehow caused by this plugin,
   because with it turned OFF, we don’t have any of these issues… but yeah, if you
   can take a look at it, and I can send you a list of plugins we’re using on our
   end to test with, if you want, that’d be great.
 *  [Tarek Aziz](https://wordpress.org/support/users/tarekht/)
 * (@tarekht)
 * [1 year, 7 months ago](https://wordpress.org/support/topic/mysql-warnings-from-helper-function-php-code/#post-18085175)
 * Thank you so much, [@crazyserb](https://wordpress.org/support/users/crazyserb/),
   for the prompt response.
 * Yes, absolutely! We are more than happy to look into our plugin and address any
   issues that are found.
 * Therefore, it would be greatly appreciated if you could kindly send a list of
   the plugins currently active on your website.
 * Could you please create a ticket in our dedicated support center?
 * _**[https://woolentor.com/contact/](https://woolentor.com/contact/)**_
 * This will help us determine the issue quicker and provide an effective solution.
 * Kind regards,
    Tarek Aziz
 *  [Tarek Aziz](https://wordpress.org/support/users/tarekht/)
 * (@tarekht)
 * [1 year, 7 months ago](https://wordpress.org/support/topic/mysql-warnings-from-helper-function-php-code/#post-18092724)
 * Hello [@crazyserb](https://wordpress.org/support/users/crazyserb/),
 * I hope you are doing well.
 * I just wanted to let you know that we have thoroughly investigated the plugin
   and resolved the issue in the latest update.
 * Could you please update the plugin to its most recent version and check if it
   resolves the issue?
 * Please let me know how it goes. Your feedback would be greatly appreciated.
 * Wishing you all the best!
    -  This reply was modified 1 year, 7 months ago by [Tarek Aziz](https://wordpress.org/support/users/tarekht/).
 *  Thread Starter [CrazySerb](https://wordpress.org/support/users/crazyserb/)
 * (@crazyserb)
 * [1 year, 7 months ago](https://wordpress.org/support/topic/mysql-warnings-from-helper-function-php-code/#post-18092931)
 * Hmm, nope. Those errors are still coming up, hundreds per second.
   In the case
   of the first one reported I only see this variation of it now:`2024-10-24 4:00:
   38 user @ localhost [] WARNING 1292: Truncated incorrect DECIMAL value: '' : 
   SELECT MIN( CAST( meta_value AS DECIMAL(10, 2) ) ) FROM wp_postmeta WHERE meta_key
   = '_price'`where the value is empty. I guess you fixed the issue for non-empty
   values.Taking a look at your code, I can assume that the full fix for that query
   would look something like this
 * `SELECT MAX( CAST( meta_value AS DECIMAL(10, 2) ) ) FROM {$wpdb->postmeta} WHERE
   meta_key = %s AND meta_value != '' ... `
 * However, the 2nd error reported, with the long query, that one is still being
   logged over and over. And I can’t figure out where that’s coming from either 
   from which specific function/code…
    -  This reply was modified 1 year, 7 months ago by [CrazySerb](https://wordpress.org/support/users/crazyserb/).
 *  [Tarek Aziz](https://wordpress.org/support/users/tarekht/)
 * (@tarekht)
 * [1 year, 7 months ago](https://wordpress.org/support/topic/mysql-warnings-from-helper-function-php-code/#post-18093072)
 * Hello [@crazyserb](https://wordpress.org/support/users/crazyserb/),
 * Thanks for sharing your feedback. We are not experiencing such issues on our 
   end.
 * Anyway, there is nothing to worry about. Would you kindly make some changes to
   the queries whose screenshot you shared earlier?
 * Please make sure that you use meta_value REGEXP ‘^[0-9]+(\.[0-9]+)?$’ for both
   $value_min and $value_max
 * Hopefully, it will fix the issue.
 * Here is an example for your convenience:
 *     ```
       $value_min = $wpdb->get_var( $wpdb->prepare( "
           SELECT MIN( CAST( meta_value AS DECIMAL(10, 2) ) ) 
           FROM {$wpdb->postmeta} 
           WHERE meta_key = %s 
           AND meta_value REGEXP '^[0-9]+(\.[0-9]+)?$'", 
           '_price' 
       ));
       ```
   
 * Please keep me updated on the status of this issue. I eagerly look forward to
   hearing from you.
 * Best regards,
    Tarek Aziz
 *  Thread Starter [CrazySerb](https://wordpress.org/support/users/crazyserb/)
 * (@crazyserb)
 * [1 year, 7 months ago](https://wordpress.org/support/topic/mysql-warnings-from-helper-function-php-code/#post-18093082)
 * Yeah, that fixes the 1st one, definitely.
 * Now, as far as that 2nd one, it has something to do with Elementor Pro plugin,
   as if I turn off either one (Elementor or Shoplentor) of the plugins the problem
   goes away. Obviously, kinda need both, so… any idea on how to go about fixing
   that query?
 *  Thread Starter [CrazySerb](https://wordpress.org/support/users/crazyserb/)
 * (@crazyserb)
 * [1 year, 6 months ago](https://wordpress.org/support/topic/mysql-warnings-from-helper-function-php-code/#post-18155418)
 * Did you push this change on your end to your core code as well?
   I think I got
   an update pushed on my end and it didn’t have this code in place, so I had to
   re-apply this fix all over again.
 *  [Tarek Aziz](https://wordpress.org/support/users/tarekht/)
 * (@tarekht)
 * [1 year, 6 months ago](https://wordpress.org/support/topic/mysql-warnings-from-helper-function-php-code/#post-18158015)
 * Hello [@crazyserb](https://wordpress.org/support/users/crazyserb/),
 * We are extremely sorry for any inconvenience it may have caused.
 * It seems the change was unintentionally included in the core. Please rest assured
   that we’ll address this in the next update.
 * Thanks a lot for your understanding and patience!
 *  Thread Starter [CrazySerb](https://wordpress.org/support/users/crazyserb/)
 * (@crazyserb)
 * [1 year, 6 months ago](https://wordpress.org/support/topic/mysql-warnings-from-helper-function-php-code/#post-18163135)
 * Here’s another “PHP Warning” that we’re seeing constantly clog up our error_log:
 * PHP Warning: Undefined array key “max_price” in /home/public_html/wp-content/
   plugins/woolentor-addons/classes/class.product_query.php on line 260
   PHP Warning:
   Undefined array key “min_price” in /home/public_html/wp-content/plugins/woolentor-
   addons/classes/class.product_query.php on line 260
 * Might be another check for valid values requred in that file instead of assuming
   all these values will always end up returning as expected per your default scenario.
 * Or rather, that get_meta_query() function might need this line changed:
 *     ```wp-block-code
           if( isset( $_GET['min_price'] ) || isset( $_GET['max_price'] ) ){
       ```
   
 * to use AND instead of OR condition.
 *  [Tarek Aziz](https://wordpress.org/support/users/tarekht/)
 * (@tarekht)
 * [1 year, 6 months ago](https://wordpress.org/support/topic/mysql-warnings-from-helper-function-php-code/#post-18163284)
 * Hi there,
 * Thank you very much for bringing these warnings to our attention. Also, we greatly
   appreciate you for sharing your thoughtful suggestions with us. Don’t worry; 
   we’ll thoroughly investigate our plugin and do our best to resolve the issue 
   in the next update.
 * In the meantime, your patience and cooperation are highly expected as we work
   on this 🙂
 * Wishing you a wonderful day ahead!

Viewing 11 replies - 1 through 11 (of 11 total)

The topic ‘MySQL warnings from helper-function.php code’ is closed to new replies.

 * ![](https://ps.w.org/woolentor-addons/assets/icon-256x256.png?rev=3011160)
 * [ShopLentor – All-in-One WooCommerce Growth & Store Enhancement Plugin](https://wordpress.org/plugins/woolentor-addons/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woolentor-addons/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woolentor-addons/)
 * [Active Topics](https://wordpress.org/support/plugin/woolentor-addons/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woolentor-addons/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woolentor-addons/reviews/)

 * 11 replies
 * 2 participants
 * Last reply from: [Tarek Aziz](https://wordpress.org/support/users/tarekht/)
 * Last activity: [1 year, 6 months ago](https://wordpress.org/support/topic/mysql-warnings-from-helper-function-php-code/#post-18163284)
 * Status: resolved