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

Fix php8 change, '' != 0 since php8 #30997

Merged
merged 2 commits into from
Sep 17, 2024

Conversation

MaximilienR-easya
Copy link
Contributor

Fix

Since PHP8 '' != 0 which change the behavior on dispatch.

Pre PHP8 when you don't fill a quantity it was accepted as 0 and don't check if a warehouse is set

On develop, you use a new function GETPOSTFLOAT which use (float) price2num GETPOST and since there is a cast to float, the empty string become a 0, it has the same reaction as pre PHP8

But here on dolibarr V18, there is no GETPOSTFLOAT or anything to change the empty string to 0, and it goes inside the "if" and return an error if a warehouse is not set

To prevent this change of behavior, I just added a check !empty(GETPOST($qty))

@eldy eldy merged commit f64a078 into Dolibarr:18.0 Sep 17, 2024
2 of 4 checks passed
@MaximilienR-easya MaximilienR-easya deleted the 18.0_Fix_php8_empty_string_0 branch September 19, 2024 12:50
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.

2 participants