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

Biginteger issue on Queries #171

Closed
ghost opened this issue Oct 25, 2018 · 14 comments
Closed

Biginteger issue on Queries #171

ghost opened this issue Oct 25, 2018 · 14 comments
Labels

Comments

@ghost
Copy link

ghost commented Oct 25, 2018

If you have biginteger as types in your database, I've found that you may get wrong id's in your query details in Telescope.

Here are some examples of id's. The upper id is the id, you may have in the url. The lower id is the result in Telescope.

189656563
189656563

18965656326
18965656326

1896565632644
1896565632644

189656563264489
189656563264489

18965656326448986
18965656326448984

1896565632644898696
1896565632644898800

In laravel itself I have no errors.

@themsaid
Copy link
Member

Wrong ids where? Which part is displaying the wrong IDs? Can you share a screenshot?

@ghost
Copy link
Author

ghost commented Oct 25, 2018

ID in database: 1898010790473457955
capture

@themsaid
Copy link
Member

@ForzaSFerrari can you check the network tab for the preview screen, find the body of the entry and see if the number is correct there, you should see it in the JSON content under the "bindings" key.

@ghost
Copy link
Author

ghost commented Oct 25, 2018

Chrome/Opera (API): Binding says 1898010790473457955
Chrome/Opera (Network Tab): Binding says 1898010790473458000

Firefox (API and Network Tab): Binding says 1898010790473458000

@themsaid
Copy link
Member

And the value in the database?

@ghost
Copy link
Author

ghost commented Oct 26, 2018

value in the database is 1898010790473457955

@themsaid
Copy link
Member

Can you open a PR with the fix since you can replicate the issue?

@ghost
Copy link
Author

ghost commented Oct 29, 2018

I haven't looked into it now, because I wouldn't know where it come from. But I could try to find it out.

@ghost
Copy link
Author

ghost commented Oct 30, 2018

For me it looks like an issue at the sql formatter package. Not at Laravel Telescope itself.

@ghost
Copy link
Author

ghost commented Oct 30, 2018

@themsaid what is the right package of this? highlight.js/lib/languages/sql
I really believe I get this error through a package and not through Telescope itself.

@themsaid
Copy link
Member

I can't seem to replicate this issue and there seems to be no one else reporting the same behaviour. I'm going to close this for now.

Please open a PR in case you figured out a way to fix it on your machine so we can verify.

Also if anyone else is facing the same issue please ping me.

Thanks

@ghost
Copy link
Author

ghost commented Nov 13, 2018

For me it's an error from an external package, but if I don't get no answer here or via mail by you, I will not research further, because I also have to do other things.

@billriess
Copy link

billriess commented Jun 18, 2019

I've just hit this issue as well. When dealing with a large ID telescope is decrementing the reported ID by 1 even though the response is correct. This means the data in telescope cannot be trusted. If casted as a string it works fine.

As mentioned above, the entry in the database in telescope_entries is correct. This may be a front-end related issue coming from the package leezng/vue-json-pretty I did some local testing and updated to the latest version of that package (1.6.0) but it did not resolve the problem.

Additionally, to recreate this, just set an integer value to 9999999999999999. The response in your browser or API tool will report back correctly but when viewing the request in Telescope it will have a value like 9999999999999998.

@billriess
Copy link

billriess commented Jun 18, 2019

Update 2

I found the issue.
There is a limitation in JS with larger numbers. The max value before integers start having weird behavior is 9007199254740991. Any number larger than this in JS will start to return the wrong value.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER

I don't know that this would be a bug or not for Telescope. I suppose Telescope could check if the number is larger than this and throw a warning and cast the number as a string.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants