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

Fix error pagination #3451

Merged
merged 2 commits into from
Apr 16, 2020
Merged

Conversation

webant-ltd
Copy link

@webant-ltd webant-ltd commented Mar 13, 2020

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tickets n/a
License MIT
Doc PR n/a

I integrate a schemathesis tool for automatically testing api based on the openapi standard

When setting a large pag value, for example 9223372036854775807, a 500 error is caused

"Return value of ApiPlatform \ Core \ DataProvider \ Pagination :: getOffset () must be of the type integer, float returned"

Added a check for the type of the return value in the getOffset method on Pagination class,

if the value is outside the scope of int64 (https://www.php.net/manual/en/language.types.integer.php) throw an error "Large page and limit values"

Copy link
Member

@soyuka soyuka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a unit test

src/DataProvider/Pagination.php Outdated Show resolved Hide resolved
@webant-ltd
Copy link
Author

@soyuka I add test

@alanpoulain
Copy link
Member

A unit test too would be even better, but I think it's fine.

@soyuka soyuka changed the base branch from master to 2.5 April 16, 2020 12:34
@soyuka soyuka merged commit da3a295 into api-platform:2.5 Apr 16, 2020
@soyuka
Copy link
Member

soyuka commented Apr 16, 2020

Thanks @webant-ltd @vladimirDaron !

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.

None yet

4 participants