Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Divide by Zero #2876

Closed
bhsmither opened this issue Jun 4, 2021 · 1 comment
Closed

Divide by Zero #2876

bhsmither opened this issue Jun 4, 2021 · 1 comment
Assignees
Labels
Milestone

Comments

@bhsmither
Copy link
Contributor

There is a consequence of #2770, see: https://forums.cubecart.com/topic/56970-upgrade-to-643-now-getting-this-error/

In /classes/cubecart.class.php, near lines 125-127, find:

if ($product_review[0]['Score'] !== "") {
  $product['review_score'] = round($product_review[0]['Score']/$product_review[0]['Count'], 1);
}

Suggest:

if (!empty($product_review[0]['Count'])) {
  $product['review_score'] = round($product_review[0]['Score']/$product_review[0]['Count'], 1);
}
@abrookbanks abrookbanks self-assigned this Jun 8, 2021
@abrookbanks abrookbanks added the bug label Jun 8, 2021
@abrookbanks abrookbanks added this to the 6.4.4 milestone Jun 8, 2021
@abrookbanks
Copy link
Member

I was going to suggest;

if (!empty($product_review[0]['Count']) && $product_review[0]['Count']>0) {

but 0 is empty.

abrookbanks added a commit that referenced this issue Jun 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants