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

Correct non-numeric value. #4166

Merged

Conversation

mc12345678
Copy link
Contributor

When using PHP 7.4+ and attempting to perform mathematical operations against an empty string (''), a warning message is generated about a non-numeric value being encountered as a result of the returned value from the price function zen_get_discount_calc. Although the thread where this was recently reported identifies problems with the output from that function, there are mathematical operations performed within the function that could also cause similar messages because the empty quote may be multiplied by a number which is expected to also generate a warning.

This appears to resolve the issue identified at this specific post: https://www.zen-cart.com/showthread.php?227580-A-non-numeric-value-encountered-in-shopping_cart-php&p=1376008#post1376008

When using PHP 7.4+ and attempting to perform mathematical operations against an empty string (`''`), a warning message is generated about a non-numeric value being encountered as a result of the returned value from the price function `zen_get_discount_calc`.  Although the thread where this was recently reported identifies problems with the output from that function, there are mathematical operations performed within the function that could also cause similar messages because the empty quote may be multiplied by a number which is expected to also generate a warning.

This appears to resolve the issue identified at this specific post: https://www.zen-cart.com/showthread.php?227580-A-non-numeric-value-encountered-in-shopping_cart-php&p=1376008#post1376008
@mc12345678
Copy link
Contributor Author

If not mistaken, isn't this already effectively addressed in #4153? Sorry if so and also if so covered/fixed then this could be closed.

@drbyte
Copy link
Member

drbyte commented Jan 8, 2021

Aha! Yes! That's where I'd seen it. And that's why I thought we'd fixed it.
And it's also why I wasn't seeing it in my tests.

Still, I think your suggested fix is also beneficial.

@drbyte drbyte merged commit b10a76a into zencart:v157 Jan 8, 2021
drbyte added a commit to drbyte/zencart that referenced this pull request Jan 8, 2021
@mc12345678
Copy link
Contributor Author

Not where I can easily follow the additional code, so asking here, in the additional merges did the admin side also get updated?

drbyte added a commit that referenced this pull request Jan 8, 2021
Copy changes to admin copy of same function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants