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

CP treats the number zero as a falsey value and doesn't write it to file. #845

Closed
jasonvarga opened this Issue Aug 9, 2016 · 5 comments

Comments

Projects
None yet
5 participants
@thomasgerard

This comment has been minimized.

thomasgerard commented Mar 13, 2017

Hello,
The bug is still present as of v2.5.5

@jackmcdade

This comment has been minimized.

Member

jackmcdade commented Mar 16, 2017

Unfortunately that's how YAML works. The best workaround is to not use the number 0 or 1 explicitly as data. What's your use case? Maybe we can help you find a solid solution?

@alexroper

This comment has been minimized.

alexroper commented Mar 16, 2017

Use case is listing the number of bedrooms for an apartment floor plan. Studio apartment = 0 bedrooms. Is there no way to store zero with quotes around it?

@edalzell

This comment has been minimized.

edalzell commented Mar 16, 2017

This is solvable @jackmcdade/@jasonvarga if there was an Integer fieldtype. Just put return $data ? $data : "0"; in the preProcess method of the IntegerFieldtype.php?

Or an integer tag that changes a null to 0?

@jasonvarga

This comment has been minimized.

Member

jasonvarga commented Mar 16, 2017

Fixed for next release.

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