Skip to content

Importing certain strings causes json_encode error #223

@balgf

Description

@balgf

Version in question: v1.8.0

To reproduce:

  1. Setup algolia search client and scout extended.
  2. Prepare table with VARCHAR column.
  3. Insert a row with text. In my case, I used this "0281E3986958"
  4. Run artisan scout:import or artisan scout:reimport

Observed behavior: An error occurs InvalidArgumentException : json_encode error: Inf and NaN cannot be JSON encoded

Expected behavior: Should import fine.

Findings:
This was caused by "0281E3986958" data that is treated as an exponential number and was converted into INF (["column" => INF]).
Line that is causing this is L116
Tried replacing ->transform($array) with ->toArray() and it imported fine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions