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

ShortURL::max('id') alway integer #297

Merged
merged 2 commits into from
Sep 17, 2024
Merged

Conversation

rshkabko
Copy link
Contributor

In some versions MySQL ShortURL::max('id') will be a string (like "2") and we will get an error.

In some versions MySQL ShortURL::max('id') will be a string (like "2") and we will get an error.
@ash-jc-allen
Copy link
Owner

Hey @rshkabko! Do you have any steps to reproduce the bug that this is fixing? 🙂

@rshkabko
Copy link
Contributor Author

Hello!
In my dev server, i use MariaDB and it's works perfectly.
But, when I push on my PROD server witch use (MySQL 8.0.26-cll-lve - Source distribution) I will get this error - https://monosnap.com/file/BJpDOLw2Uinhh4cl64fJwBUXl2YMYa

I recorded video for you with error - https://youtu.be/F7pwr2LkPfo

I have encountered such problems in the database more than once, so I always tried to solve them forcibly at the model level.

@ash-jc-allen
Copy link
Owner

Thanks for the video, that was really useful! 😄

I'm still pretty confused by what might be causing the ID to be returned as a string. Would it be possible for you to share your config/database.php contents, please? I'd love to be able to get a really good understanding of what's causing the issue in the first place before we put the fix in place, so we can avoid it anywhere else too 🙂

@rshkabko
Copy link
Contributor Author

No problem, but this is a standard config, nothing was changed at all. The only difference is the DB version and the PHP version.

Here is what chatGPT say - https://monosnap.com/file/H4Uj7WnU1LY0S6iHJLn4VMJXqB0w9y

database.php.txt

@rshkabko
Copy link
Contributor Author

rshkabko commented Sep 14, 2024

I once made a financial system, where IDs were bank card numbers (ex, 1000000000000001). So, even at the PHP level, these numbers did not pass as a integer, because they went beyond the scope of the int

https://monosnap.com/file/4BvsRpvlep7STqefBln9sdEtT0suby

@ash-jc-allen
Copy link
Owner

Thanks for the config! 🙂

Out of interest, what versions of PHP and Laravel are you using? I've not been able to reproduce this issue using the same MySQL version as what you're running.

@rshkabko
Copy link
Contributor Author

PHP 8.2.5
Laravel 11.23.4

@ash-jc-allen ash-jc-allen merged commit 3ed0c2d into ash-jc-allen:master Sep 17, 2024
9 of 11 checks passed
@ash-jc-allen
Copy link
Owner

Hey @rshkabko! I still couldn't manage to replicate the issue, but I've merged in a bug fix. I'll get it tagged and released now, and hopefully your issue will be solved 😄

@rshkabko rshkabko deleted the patch-1 branch September 17, 2024 09:49
@rshkabko
Copy link
Contributor Author

Thanks!

@ash-jc-allen
Copy link
Owner

This has now been released as part of v8.1.2 🙂

https://github.com/ash-jc-allen/short-url/releases/tag/v8.1.2

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.

2 participants