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

Prevent type conversions issues when parsing time-fractions #710

Merged
merged 1 commit into from Mar 23, 2021

Conversation

@lcobucci
Copy link
Owner

@lcobucci lcobucci commented Mar 23, 2021

We received reports of users experiencing exceptions when parsing JWTs with timestamps with precision beyond microseconds on time-fractions.

This guards against having any kind of edge-case when dealing with floats as input to the creation of DateTimeImmutable objects.

We received reports of users experiencing exceptions when parsing JWTs
with timestamps with precision beyond microseconds on time-fractions.

This guards against having any kind of edge-case when dealing with
floats as input to the creation of DateTimeImmutable objects.
Copy link
Contributor

@yassinrais yassinrais left a comment

src/Token/Parser.php:118

     * @param int|float|string $timestamp

Are you sur that its okey to put even string into param type ?

@param => accepted type in 'documentation'

Loading

@lcobucci
Copy link
Owner Author

@lcobucci lcobucci commented Mar 23, 2021

src/Token/Parser.php:118

     * @param int|float|string $timestamp

Are you sur that its okey to put even string into param type ?

@param => accepted type in 'documentation'

Not accepting it is a BC-break with previously created tokens in v4. So, we have to support until v5 - that's also why I added a test to cover that.

We can mark that as deprecated but it's not really a hill I'd die on.

Loading

Copy link
Contributor

@yassinrais yassinrais left a comment

some bad news : https://3v4l.org/pTqmM 🤔 wait a minute nvm, i forgot the was u.u 😅 and number_format add .u format to integer

Loading

@yassinrais
Copy link
Contributor

@yassinrais yassinrais commented Mar 23, 2021

I dont have anything to add 💪 gj

Loading

@lcobucci lcobucci merged commit ae4165a into 4.0.x Mar 23, 2021
21 checks passed
Loading
@lcobucci lcobucci deleted the guard-against-potential-precision-issues branch Mar 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

2 participants