Wrong Bigint value in API request using pagination #33316
Replies: 1 comment
-
Pretty convenient, I'm actually having the same issue with using bigint on the resources. This is the actual bigint I'm trying to use: This is what I get in return: However this doesn't just occur on pagination-ed collections, it also occurs on literally any resource. At first me and a friend thought maybe PHP couldn't process the bigint but dd/die debugging it displays the correct number. Edit: After posting this a friend let me know this will happen when you serialize to json - best solution so far is to just cast to a string I suppose. He sent this as an explanation: https://tools.ietf.org/html/rfc7159#section-6 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Description:
I use pagination to return in api response and it show wrong value of bigint fields. Example below:
{ "current_page":200, "data":[ { "id":104253013262866000, "league_id":101097443346691680, "tournament_id":104253013242629780, "team1_id":104251016988118460, "team2_id":103535282148790980 } ] }In model file, i cast field to string then it work
{ "current_page":200, "data":[ { "id":"104253013262865997", "league_id":"101097443346691685", "tournament_id":"104253013242629769", "team1_id":"104251016988118464", "team2_id":"103535282148790975" } ] }My dump value still show right int value, example
dd($items[0]->toArray())Steps To Reproduce:
Beta Was this translation helpful? Give feedback.
All reactions