Question: I've got something that bugs me : when somebody requests a route with an id greater than PHP\_INT\_MAX, the id is passed as a string to my controller, thus throwing a 500 error, as my controller's parameters are typed.

For example, given I'm on a 64-bit system, PHP\_INT\_MAX's value is 2^63-1 (9223372036854775807).
If I call my route with 9223372036854775808 (PHP\_INT\_MAX+1, which is still considered as an integer by the router), the kernel tries to send `9.2233720368548E+18` to my controller, hence the 500 error.

I doubt there isn't any way to prevent that to happen, but I didn't find any way to catch this integer-now-string in order to throw a custom error and not the default 500 error I'm having.

Edit: My ids aren't this big, but such an error has been triggered this week-end, alerting the on-call team for nothing. That's why I want to replace it by a 40X error.

Answer: 
On your system `PHP_INT_MAX` has 19 digits. So you could add a route requirement to match only when id has 1-18 digits:

```
/**
 * @Route(
 *     "/some/route/{id}",
 *     requirements={"id"="\d{1,18}"}
 * )
 */
public function yourAction(int $id)
{
    ...
}

```

More than 18 digits wouldn't match and result in a 404.

But yes, you will "lose" capability to match ids > 999999999999999999 and < PHP\_MAX\_INT, and yes PHP\_MAX\_INT can vary. But this might just be good enough.
You can create a customer Param Converter in your case (<https://symfony.com/doc/current/bundles/SensioFrameworkExtraBundle/annotations/converters.html#creating-a-converter>). And apply only for this kind of routes.