You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 21, 2020. It is now read-only.
If you configure a page size parameter, values that are not positive integers (or -1) will result in a 500 Internal Server Error and a stack trace. The exceptions that trigger this (vendor/zfcampus/zf-hal/src/Collection.php line 302 and 310) indicate the problem is one of validation rather than something going wonky on the server. IMHO, this should not be a 500, but could either be a 400 or 422 or it could "fail safe" back to using the configured default and not causing an error at all.
The text was updated successfully, but these errors were encountered:
Since this was opened, the class has been updated so that -1 indicates no pagination. So the above is still true for values that are not positive integers, other than -1. The exceptions thrown are now on 287 and 295 instead of the original 302 and 310.
It appears the fix for this would probably be in zf-rest in \ZF\Rest\RestController in prepareHalCollection. The call to $collection->setPageSize($this->getPageSize()); could be wrapped in a try..catch and return an ApiProblem rather than letting the ZF\Hal\Exception\InvalidArgumentException bubble all the way out and become a 500. If this sounds like an acceptable way of handling it, I'm happy to make a PR. I don't think this should be a 5xx error though.
If you configure a page size parameter, values that are not positive integers (or -1) will result in a 500 Internal Server Error and a stack trace. The exceptions that trigger this (vendor/zfcampus/zf-hal/src/Collection.php line 302 and 310) indicate the problem is one of validation rather than something going wonky on the server. IMHO, this should not be a 500, but could either be a 400 or 422 or it could "fail safe" back to using the configured default and not causing an error at all.
The text was updated successfully, but these errors were encountered: