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

Input array with an empty string fails to be loaded #881

Closed
matteo-cristino opened this issue May 13, 2024 · 0 comments · Fixed by #882
Closed

Input array with an empty string fails to be loaded #881

matteo-cristino opened this issue May 13, 2024 · 0 comments · Fixed by #882
Labels
beelzebug Demonic bug that transcends the laws of relativistic physics

Comments

@matteo-cristino
Copy link
Collaborator

matteo-cristino commented May 13, 2024

Detected a really strange behaviour when trying to load array with an mepty string in it.

To reproduce use the contract

Given I have a 'string array' named 'the_array'
Then print 'the array'

with data

{
    "the_array": [
        0,
        "a",
        "",
       "hello"
    ]
}

and you will get

[W]  JSON encoding error: table
[!]  Zencode runtime error
[!]  [source 'json']:88: invalid table: sparse array (n=3, #val=4)

This is returned only when the empty string is not the last element in the array, but in this case it is simply removed. For example using the above cotnract with data

{
    "the_array": [
        0,
        "a",
        ""
    ]
}

The result is

{
    "the_array": [
        0,
        "a"
    ]
}

Notice this behavior by updating zenroom in slangroom and tests start failing. Tests passed with zenroom 4.6.0 thus is something we have modified between it and latest commit.

@matteo-cristino matteo-cristino added the beelzebug Demonic bug that transcends the laws of relativistic physics label May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beelzebug Demonic bug that transcends the laws of relativistic physics
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant