wp-e-commerce / WP-e-Commerce

WP eCommerce - The most popular independent eCommerce platform for WordPress
https://wpecommerce.org
GNU General Public License v2.0
215 stars 217 forks source link

non-numeric value encountered in wpsc-includes/processing.functions.php on line 275 #2364

Closed galbaras closed 3 years ago

galbaras commented 6 years ago

I'm getting the above PHP warnings, and it looks like the $in_weight input isn't being validated before being used.

My store actually has shipping disabled, so wpsc_convert_weight() can be skipped.

JeffPyeBrook commented 6 years ago

I have a bunch of these fixed that I need to get into a pull request.

The root cause is that in several places in core the empty string ('') is used to initialize variables that will eventually hold integers or floats. In PHP 7.1 & 7.2 that will generate warnings.

Wholesale changing all of the initializations is not the best idea because some plugins or other functions might be comparing to empty string and taking a different course of action than if the value was 0.

galbaras commented 6 years ago

How about explicitly casting to integer then?

galbaras commented 3 years ago

@JustinSainton Any reason you've closed this issue?