Skip to content
This repository has been archived by the owner on Jun 26, 2018. It is now read-only.

Bug fix for int value of "0" #1

Merged
merged 2 commits into from
Mar 29, 2013
Merged

Bug fix for int value of "0" #1

merged 2 commits into from
Mar 29, 2013

Conversation

laurent22
Copy link
Contributor

Hello,

The current implementation of Toml::parseValue() was incorrectly setting int values of 0 to null. This is because empty("0") (surprisingly) returns true. The fix is to check with strict equality with "" instead.

Also, I took the liberty to change the way the parser handles empty values. It is now throwing an UnexpectedValueException since empty values are currently not allowed by the spec. And looking at the discussion on the issue page it doesn't seem likely it is going be allowed.

I've also added the tests for these two changes.

Many thanks for your library by the way, and hope the fix is useful.

Best,

Laurent

Added test for int value = 0, and null not supported.
Fix for int value = 0, and throw exception for null values.
zidizei added a commit that referenced this pull request Mar 29, 2013
Bug fix for int value of "0"
@zidizei zidizei merged commit 4ffdeeb into zidizei:master Mar 29, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants