Zen Cart Logo
Forums / General Questions / All of a sudden getting: PHP Warning: Division by zero in .. error log files

All of a sudden getting: PHP Warning: Division by zero in .. error log files

Views: 2,674

Results 1 to 7 of 7
16 Jul 2013, 5:06 PM
#1
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Location:
Bedford, England
Posts:
968
Plugin Contributions:
0

All of a sudden getting: PHP Warning: Division by zero in .. error log files

I have all of a sudden start getting the following warning:

[16-Jul-2013 10:16:32 UTC] PHP Warning: Division by zero in /home/site/public_html/includes/functions/functions_general.php on line 1345

nothing has been changed in the files and nothing I am aware of has been changed server side.

the line 1345 is this in my file:

$zc_round = ($x1000)/($y1000);

any idea what could be causing the warning?

Cheers

Phil

16 Jul 2013, 5:32 PM
#2
stevesh avatar

stevesh

Black Belt

Join Date:
Feb 2005
Location:
Lansing, Michigan USA
Posts:
19,793
Plugin Contributions:
2

Re: All of a sudden getting: PHP Warning: Division by zero in .. error log files

Do you have any '0' values in Admin - Configuration - Maximum Values ?

16 Jul 2013, 5:43 PM
#3
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Location:
Bedford, England
Posts:
968
Plugin Contributions:
0

Re: All of a sudden getting: PHP Warning: Division by zero in .. error log files

stevesh:

Do you have any '0' values in Admin - Configuration - Maximum Values ?

yes Maximum Orders Detail Display on Admin Orders Listing = 0

not sure thats anything to do with it though?

16 Jul 2013, 5:47 PM
#4
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Location:
Bedford, England
Posts:
968
Plugin Contributions:
0

Re: All of a sudden getting: PHP Warning: Division by zero in .. error log files

here are the places the function that uses that line of code are called:

Searching 1073 files ... for: fmod_round

/home/site/public_html/includes/classes/shopping_cart.php

Line #1206 : if ( fmod_round($check_quantity,$check_units) != 0 ) {

/home/site/public_html/includes/functions/1-dynamic-functions_general.php

Line #1337 : function fmod_round($x, $y) {

/home/site/public_html/includes/functions/functions_general.php

Line #1341 : function fmod_round($x, $y) {

/home/site/public_html/includes/functions/functions_prices.php

Line #769 : $new_units = $check_units - fmod_round($_SESSION['cart']->in_cart_mixed($product_id), $check_units);

16 Jul 2013, 6:20 PM
#5
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: All of a sudden getting: PHP Warning: Division by zero in .. error log files

Have you set the products_quantity_order_units field in your products table to 0 for any products? If so, that'll cause that sort of problem.

That would never be possible using the ZC Admin to manage products, but if you're using some external tool to manipulate your database, that could be causing the problem for you.

16 Jul 2013, 9:22 PM
#6
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Location:
Bedford, England
Posts:
968
Plugin Contributions:
0

Re: All of a sudden getting: PHP Warning: Division by zero in .. error log files

Ah could be easy populate, I've used a different version to what I used to use. What would that value be doing?
I'll head in and have a look at some of my new products

16 Jul 2013, 9:58 PM
#7
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Location:
Bedford, England
Posts:
968
Plugin Contributions:
0

Re: All of a sudden getting: PHP Warning: Division by zero in .. error log files

DrByte:

Have you set the products_quantity_order_units field in your products table to 0 for any products? If so, that'll cause that sort of problem.

That would never be possible using the ZC Admin to manage products, but if you're using some external tool to manipulate your database, that could be causing the problem for you.

perfect, thanks DrByte. we had some of these we noticed before and thought they had all been changed. now ive done a search on the db for the feild you mentioned I have now identified ones that skipped the radar. which is just as well as it doesnt allow the customer to checkout with them as they are. thanks.

Phil