Problem/Motivation

The DrimageSubscriber::onKernelRequest() method does not properly set a response using $event->setResponse() when delivering generated images. Additionally, several error branches are missing return statements, which may allow execution to continue and cause unexpected behavior.

This can result in:

  • Images not being delivered correctly
  • Duplicate processing
  • Unexpected fall-through logic
  • Possible PHP warnings or broken responses
  • Inconsistent kernel request handling

Steps to reproduce

  1. Request a generated Drimage image.
  2. Trigger a path handled by DrimageSubscriber.
  3. Observe that response handling is incomplete.
  4. Error branches continue execution without returning.
  5. Image delivery may fail or behave inconsistently.

Proposed resolution

Update `DrimageSubscriber::onKernelRequest()` to:

  • Call $event->setResponse($response) when an image response is generated
  • Add missing return statements after setting responses
  • Add return statements in error handling branches
  • Ensure early exits when request is fully handled

This ensures proper Symfony event handling and prevents fall-through execution.

Remaining tasks

  • ✅ File an issue
  • ➖ Addition/Change/Update/Fix
  • ➖ Testing to ensure no regression
  • ➖ Automated unit testing coverage
  • ➖ Automated functional testing coverage
  • ➖ UX/UI designer responsibilities
  • ➖ Readability
  • ➖ Accessibility
  • ➖ Performance
  • ➖ Security
  • ➖ Documentation
  • ➖ Code review by maintainers
  • ➖ Full testing and approval
  • ➖ Credit contributors
  • ➖ Review with the product owner
  • ➖ Release notes snippet
  • ❌ Release

API changes

  • N/A

Data model changes

  • N/A

Release notes snippet

  • N/A
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

rajab natshah created an issue. See original summary.

rajab natshah’s picture

Assigned: rajab natshah » josebc
Issue summary: View changes
Status: Active » Needs review

josebc made their first commit to this issue’s fork.

  • josebc committed 9d9c7450 on 1.0.x authored by rajab natshah
    fix: #3587334 Missing response and return handling in DrimageSubscriber...
josebc’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

rajab natshah’s picture

Assigned: josebc » Unassigned

Status: Fixed » Closed (fixed)

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