• Resolved pbolduc99

    (@pbolduc99)


    My PHP log is filling up with 2 reoccurring errors. Any help would be appreciated. Please see below the errors from the error.log

    [25-Aug-2019 18:18:25 UTC] PHP Warning: A non-numeric value encountered in /home/central/public_html/dukemaps/wp-content/plugins/wp-product-review/includes/functions.php on line 335
    [25-Aug-2019 18:18:25 UTC] PHP Warning: A non-numeric value encountered in /home/central/public_html/dukemaps/wp-content/plugins/wp-product-review/includes/functions.php on line 339

    Thanks,
    Paul

    The page I need help with: [log in to see the link]

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Contributor contactashish13

    (@rozroz)

    @pbolduc99

    • is this happening for every review you have created or only for a particular review?
    • could you please provide a screenshot of the configuration of one review, especially the options?
    Thread Starter pbolduc99

    (@pbolduc99)

    Thank you for the prompt reply, this is happening for all review posts. This seems to be a syntax problem with the function.php file and PHP Version 7.3.8. It is filling up my hard-drive very fast writing thousands of these two lines to my log file.

    Here is what 335 of the functions.php looks like:

    <span><?php echo esc_html( number_format( ( $option[‘value’] / $scale ), 1 ) ); ?>/<?php echo $display; ?></span>

    Here is what 339 of the functions.php looks like:

    $rating = round( $option[‘value’] / $scale );

    Please see the link for a screenshot of my plugin settings.
    https://www.dropbox.com/s/48v81boukqgz1p6/General%20Settings.jpg?dl=0

    I think I misunderstood what you wanted for a screenshot. Please see the Product review settings within a POST page.

    https://www.dropbox.com/s/cgow9qgsab3k84t/Product-Review-Post.jpg?dl=0

    I think I might have an idea of why this might be happening. With a recent update to Product Review they added a new field called Product Price. I don’t want a product price to show up. So I removed the value from Product Price of “0.00” so it doesn’t display.

    Perhaps because there is no value associated to this, it is throwing the error? If this is the problem how can I go about disabling product price as there will never be a price associated nor do I want the review to show a price. I have close to 1000 Product reviews and I don’t want to have to edit each review because of this.

    Thanks!

    • This reply was modified 5 years, 7 months ago by pbolduc99.
    • This reply was modified 5 years, 7 months ago by pbolduc99.
    • This reply was modified 5 years, 7 months ago by pbolduc99.
    • This reply was modified 5 years, 7 months ago by pbolduc99.
    • This reply was modified 5 years, 7 months ago by pbolduc99.
    • This reply was modified 5 years, 7 months ago by pbolduc99.
    • This reply was modified 5 years, 7 months ago by pbolduc99.
    Plugin Contributor contactashish13

    (@rozroz)

    @pbolduc99 the field “produce price” has been there ever since the plugin was a baby ?? Keeping it empty does not cause this problem, at least not when we reproduce it. You can try either of the 2 things:

    • Provide a value of 0 as the price (not 0.0)
    • If the above does not work, hide the price display with CSS:
      .cwp-item-price { display: none }
    Thread Starter pbolduc99

    (@pbolduc99)

    Will this stop the PHP error log from filling up? I need a solution to stop these warnings in my PHP log. Also I’m not sure where I would place that CSS code. Could you please provide me with more specifics on where to input that CSS code if it is a necessary fix. I am only interested in stopping the warnings that are filling up the log file as they keep reoccurring. If it is unrelated to Product Price then I am not interested in adding the CSS code.

    Thank you,

    • This reply was modified 5 years, 6 months ago by pbolduc99.
    • This reply was modified 5 years, 6 months ago by pbolduc99.
    • This reply was modified 5 years, 6 months ago by pbolduc99.
    Plugin Contributor contactashish13

    (@rozroz)

    @pbolduc99 have you tried our first suggestion?

    Thread Starter pbolduc99

    (@pbolduc99)

    I haven’t, I have over 1000 pages that have this review plugin associated with. 0.00 is the default value that your plugin provides natively. These warnings also keep reoccurring in the log. If I change one post page review how will I know if it worked or not? I would somehow need a script to change the value on all post review pages to know if it works or not and I don’t know how to do that.

    I would need to know where in the database this value 0.00 is stored to change it to 0 for all post reviews. It would be very much appreciated, since this warning is generated by your plugin file you can release a fix in a future update. I am not a programmer but a power user.

    Regards,
    Paul

    • This reply was modified 5 years, 6 months ago by pbolduc99.
    • This reply was modified 5 years, 6 months ago by pbolduc99.
    • This reply was modified 5 years, 6 months ago by pbolduc99.
    • This reply was modified 5 years, 6 months ago by pbolduc99.
    • This reply was modified 5 years, 6 months ago by pbolduc99.
    • This reply was modified 5 years, 6 months ago by pbolduc99.
    Thread Starter pbolduc99

    (@pbolduc99)

    Okay, here is what I have done.

    In wp-content/plugins/wp-product-review/includes/functions.php

    I have changed line 335 from:
    <span><?php echo esc_html( number_format( ( $option[‘value’] / $scale ), 1 ) ); ?>/<?php echo $display; ?></span>

    And I change it to:
    <span><?php echo esc_html( number_format( ( $option[‘0’] / $scale ), 1 ) ); ?>/<?php echo $display; ?></span>

    I have changed line 339 from:
    $rating = round( $option[‘value’] / $scale );

    And I change it to:
    $rating = round( $option[‘0’] / $scale );

    I have deleted the log file and I will wait to see if it regenerates those warnings in the PHP error_log.

    Regards,
    Paul

    Thread Starter pbolduc99

    (@pbolduc99)

    While those modifications stopped the errors. It introduces another problem. Now the: Product Options “Insert your options and their grades. Grading must be done from 0 to 100.” That no longer works. The values that get returned are: 0 for each option.

    • This reply was modified 5 years, 6 months ago by pbolduc99.
    • This reply was modified 5 years, 6 months ago by pbolduc99.
    Thread Starter pbolduc99

    (@pbolduc99)

    Looks like I fixed your problem.

    Here is the solution for Line 335 & 339 in your function.php file:
    Line 335 should be:
    <span><?php echo esc_html( number_format( ( (int)$option[‘value’] / $scale ), 1 ) ); ?>/<?php echo $display; ?></span>

    Line 339 should be:
    $rating = round( (int)$option[‘value’] / $scale );

    No warnings and everything works. Make sure that your column structure is INT

    • This reply was modified 5 years, 6 months ago by pbolduc99.
    • This reply was modified 5 years, 6 months ago by pbolduc99.
Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘New Warnings Appearing in PHP Error Log’ is closed to new replies.