Trying to do arithmetic with non-numeric value
-
Hi gang,
Using a fresh install of iTheme Exchange, if I try to create a new product the following warning is generated:
Warning: A non-numeric value encountered in wp-content/plugins/ithemes-exchange/api/misc.php on line 127
It looks like, if _it_exchange_sale_price is not set for a particular product (such as a new product), then we pass an empty string to it_exchange_convert_from_database_number() which then tries to divide the empty string by 100, resulting in the error.
A cast to int might help:
function it_exchange_convert_from_database_number( $price ) { return number_format( (int) $price / 100, 2, '.', '' ); }
The warning is just a warning, and the end result with a cast in place is the same, but this would reduce noise in the error logs etc.
Be awesome if this/some other appropriate fix could be put in place!
- The topic ‘Trying to do arithmetic with non-numeric value’ is closed to new replies.