Problem/Motivation

Rivet’s rivet_preprocess_page() assumes the request exception attribute always provides getStatusCode(). Drupal can provide an EnforcedResponseException, which does not implement that method. This causes a fatal error and blank HTTP 500 response during Entity Browser/AJAX response rendering.

Steps to reproduce

  • Use Rivet 1.1.3 with Drupal 10.6.x.
  • Render an Entity Browser response using the public theme.
  • Select an existing entity and submit the selection.

The response fails with:

Call to undefined method Drupal\Core\Form\EnforcedResponseException::getStatusCode()
Expected: Non-HTTP exceptions should not cause theme preprocessing to fatal.

Proposed resolution

use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;

$status_code = $status instanceof HttpExceptionInterface
  ? $status->getStatusCode()
  : 0;

Remaining tasks

User interface changes

API changes

Data model changes

Issue fork rivet-3626018

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

jwilson3 created an issue. See original summary.

jwilson3’s picture

Assigned: Unassigned » jwilson3

jwilson3’s picture

Status: Active » Needs review

  • jwilson3 committed 4364d01c on 1.1.x
    Issue #3626018 by jwilson3: Guard page preprocessing for non-HTTP...
jwilson3’s picture

Status: Needs review » Fixed

Fixed in release 1.1.4

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.

Status: Fixed » Closed (fixed)

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