Skip to content
This repository was archived by the owner on Jul 19, 2025. It is now read-only.

PHP Parser: handle INF/NaN nodes #71

Merged
merged 1 commit into from
Jan 4, 2016
Merged

PHP Parser: handle INF/NaN nodes #71

merged 1 commit into from
Jan 4, 2016

Conversation

wfleming
Copy link
Contributor

@wfleming wfleming commented Jan 4, 2016

I tracked this back to this constant number in a source file.

It turns out the literal INF constant in a PHP source is fine:
the parser represents constants directly using the identifier, so
it's fine in JSON.

But the constant number is larger than PHP's max number, so it basically
overflows & get represented as INF after parsing.

On the belief that similar code might result in a NaN constant, I'm also
covering that one. This represents both values using constant strings
that are unlikely to actually appear in anyone's source code.

👀 @codeclimate/review

I tracked this back to this constant number in a source file.

It turns out the literal INF constant in a PHP source if fine:
the parser represents constants directly using the identifier, so
it's fine in JSON.

But the constant number is larger than PHP's max number, so it basically
overflows & get represented as INF after parsing.

On the belief that similar code might result in a NaN constant, I'm also
covering that one. This represents both values using constant strings
that are unlikely to actually appear in anyone's source code.
@gdiggs
Copy link
Contributor

gdiggs commented Jan 4, 2016

LGTM

wfleming added a commit that referenced this pull request Jan 4, 2016
@wfleming wfleming merged commit 3765013 into master Jan 4, 2016
@wfleming wfleming deleted the will/php-inf-nan branch January 4, 2016 22:11
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