Skip to content

fix INF and NaN errors#360

Open
mitchierichie wants to merge 1 commit into
algolia:masterfrom
mitchierichie:patch-1
Open

fix INF and NaN errors#360
mitchierichie wants to merge 1 commit into
algolia:masterfrom
mitchierichie:patch-1

Conversation

@mitchierichie

Copy link
Copy Markdown
Q A
Bug fix? yes
New feature? no
BC breaks? no
Related Issue Fix #223
Need Doc update no

Describe your change

Check if a string that was cast to a number is NaN or INF and don't store it in the transformed array.

What problem is this fixing?

Converting all numeric strings, is causing errors when a numeric string casts as a float to INF or NaN. This causes this package to crash the app. These attributes should just be left as strings.

Here's an example:

is_numeric('5929e536'); // true
(float) '5929e536'; // INF

@jakew009

Copy link
Copy Markdown

Thanks for fixing this

@mitchierichie

Copy link
Copy Markdown
Author

Thanks for fixing this

Hopefully it gets merged!!! 🥳

@DevinCodes DevinCodes self-requested a review June 4, 2025 07:41

@DevinCodes DevinCodes left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @mitchierichie ,

Thank you for the PR. Would you mind adding a quick unit test for this behaviour, please?

@mitchierichie

Copy link
Copy Markdown
Author

will do @DevinCodes

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Importing certain strings causes json_encode error

3 participants