Change record status: 
Project: 
Introduced in branch: 
12.0.x
Introduced in version: 
12.0.0
Description: 

\Drupal\Core\Routing\Enhancer\ParamConversionEnhancer::onException(), which converts a ParamNotConvertedException into a NotFoundHttpException, now subscribes to KernelEvents::EXCEPTION with priority 250 instead of 75.

Before

Exception subscribers with a priority between 75 and 250, such as Fast404ExceptionHtmlSubscriber (priority 200), received the original ParamNotConvertedException and did not treat it as a 404. As a result, requests whose route parameters could not be converted (for example, an image derivative for a nonexistent image style, /sites/default/files/styles/does_not_exist/public/example.png) displayed the full 404 page with the theme applied instead of the fast 404 response.

After

All exception subscribers with a priority lower than 250 receive a NotFoundHttpException.

Impact on custom or contributed code: Exception subscribers with a priority between 75 and 250 that check whether an exception is a ParamNotConvertedException will no longer receive it directly. They should check whether it is a NotFoundHttpException and, if necessary, inspect $exception->getPrevious() to obtain the original ParamNotConvertedException. They can also raise their priority above 250 to keep receiving the original exception.

Impacts: 
Module developers