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

Language alternate field with value 0 not respected #1431

Closed
dsdsdsdsdsds opened this issue Aug 24, 2021 · 2 comments
Closed

Language alternate field with value 0 not respected #1431

dsdsdsdsdsds opened this issue Aug 24, 2021 · 2 comments

Comments

@dsdsdsdsdsds
Copy link

dsdsdsdsdsds commented Aug 24, 2021

Short description of the issue

I have the two integer fields called price and price_de. When I request the value of price with language de, it only provides the correct value if price_de is any other than empty or greater than 0.

Expected behavior

While I would expect an empty field to fall back to the value of the default language, having a value 0 should actually return 0.

Actual behavior

When price_de has a value of 0, it returns the value of price.

Optional: Suggestion for a possible fix

The problem lies in LanguageSupportFields.module on line 159, where empty() is used to determine if the field has a value. It seems to me that !(isset($value) && $value !== '') should be used there.

Setup/Environment

ProcessWire 3.0.165

ryancramerdesign added a commit to processwire/processwire that referenced this issue Aug 25, 2021
@ryancramerdesign
Copy link
Member

@dsdsdsdsdsds Thanks, I've pushed a fix for this. Note that in your integer field settings, on the Details tab, for the "Are 0 and blank equivalent?" field, you'll have to select "No - blank and 0 have different meanings".

@dsdsdsdsdsds
Copy link
Author

Works, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants