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

json integer decoder callback is never called for input "0" #8580

Closed
devinus opened this issue Jun 14, 2024 · 2 comments
Closed

json integer decoder callback is never called for input "0" #8580

devinus opened this issue Jun 14, 2024 · 2 comments
Assignees
Labels
bug Issue is reported as a bug team:PS Assigned to OTP team PS

Comments

@devinus
Copy link

devinus commented Jun 14, 2024

Describe the bug

When decoding <<"0">> or <<"-0">> with the new json module, the integer/1 decoder callback is never called.

To Reproduce

json:decode(<<"0">>, ok, #{integer => fun(_) -> works end}).
%=> {0,ok,<<>>}
json:decode(<<"1">>, ok, #{integer => fun(_) -> works end}).
%=> {works,ok,<<>>}

Expected behavior

json:decode(<<"0">>, ok, #{integer => fun(_) -> works end}).
%=> {works,ok,<<>>}

Affected versions

  • 27.0

@michalmuskala

@devinus devinus added the bug Issue is reported as a bug label Jun 14, 2024
@devinus devinus changed the title json integer decoder does not work for input "0" json integer decoder callback is never called for input "0" Jun 14, 2024
@michalmuskala
Copy link
Contributor

Good catch! Fix in #8581

@IngelaAndin IngelaAndin added the team:PS Assigned to OTP team PS label Jun 16, 2024
@dgud dgud self-assigned this Jun 18, 2024
@dgud
Copy link
Contributor

dgud commented Jun 19, 2024

Fix is merged.

@dgud dgud closed this as completed Jun 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue is reported as a bug team:PS Assigned to OTP team PS
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants