Problem/Motivation
HttpStatusCode condition plugin provided by context module checks if exception is not empty. While in most situations it is fine, in some situations exception could be an object with class different from HttpException, causing the following fatal error:
Error: Call to undefined method Drupal\Core\Form\EnforcedResponseException::getStatusCode() en Drupal\context\Plugin\Condition\HttpStatusCode->evaluate() (línea 109 de /path/to/docroot/modules/contrib/context/src/Plugin/Condition/HttpStatusCode.php)
Steps to reproduce
- Create a content type FOO with media library
- Create a context using http status code condition
- Create a content with FOO content type
- Use media library to select an existing media
- Click on insert media
- You with see the previous mentioned error on the logs
Proposed resolution
Check the $exception class.
Remaining tasks
Review and test.
User interface changes
None
API changes
None
Data model changes
None
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | context-3188463-2.patch | 1.36 KB | akalam |
Issue fork context-3188463
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
Comment #2
akalam commentedComment #5
deaom commentedI can confirm this issue as I got to it when writing automated tests #3190409: Add test for context http satus code. I created a fork with a slight change to the if statement, but please give the credit to @akalam. Marking this issue as needs review (so I do not set RTBC on my own commit).
Comment #7
deaom commentedNot actually failing, so setting it back to needs review.
Comment #8
nmatja commentedI was not able to reproduce the issue but after checking the fork update everything seems okay.
Comment #9
paulocsComment #11
paulocsFixed! Thanks!