Problem/Motivation

When navigating to a non-existent url on the site (e.g. mysite.com/bla_bla), it throws the following error instead of showing "Page not found":

TypeError: Argument 1 passed to Drupal\entity_print\EventSubscriber\PrintEngineExceptionSubscriber::handleException() must be an instance of Symfony\Component\HttpKernel\Event\ExceptionEvent, instance of Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent given in Drupal\entity_print\EventSubscriber\PrintEngineExceptionSubscriber->handleException() (line 53 of modules/contrib/entity_print/src/EventSubscriber/PrintEngineExceptionSubscriber.php).

This error happened after upgrading to 2.7. Downgrading to 2.6 resolves the error.

CommentFileSizeAuthor
#6 3309925-pass.patch2.24 KBlarowlan
#6 3309925-fail.patch700 byteslarowlan

Comments

PeterE created an issue. See original summary.

larowlan’s picture

Hmm we might need a new branch for d10 support then

larowlan’s picture

In D9 the event is passed a RequestExceptionEvent.
In D10 this becomes an ExceptionEvent.
We need to find a way I can typehint this without using union types so that the module is compatible with D9 and D10.
If I use RequestException event it is a deprecation in D9 and a fatal in D10. If I use ExceptionEvent its a type error in D9 as the passed argument is the narrower RequestExceptionEvent

I can use a union type, but that'd mean dropping PHP7 support, which given the audience of this module feels disruptive. However those folks can stay on older versions I guess.

Alternatively I can do a new major version with the breaking change, ie D10 only - but that makes it harder for people to update to D10.

larowlan credited cmlara.

larowlan’s picture

larowlan’s picture

Status: Active » Needs review
StatusFileSize
new700 bytes
new2.24 KB

  • larowlan committed 4fc16b58 on 8.x-2.x
    Issue #3309925 by larowlan, cmlara: Version 2.7 throws a TypeError if...
larowlan’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.