Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Fatal error: Call to a member function setResponse() on a non-object in core/lib/Drupal/Core/ExceptionController.php on line 89
$event is not defined. Easy fix, patch attached.
Comment | File | Size | Author |
---|---|---|---|
#10 | 1816582-10-exception-405.patch | 2.2 KB | klausi |
#7 | 1816582-7-exception-405.patch | 2.2 KB | klausi |
#3 | 1816582-3-exception-405.patch | 2.07 KB | klausi |
#3 | 1816582-3-exception-405-testonly.patch | 1.48 KB | klausi |
drupal-405-response.patch | 605 bytes | klausi | |
Comments
Comment #1
Crell CreditAttribution: Crell commentedRefiling. (The wscci component is vestigial.)
Also, RTBC. :-)
Comment #2
webchickLet's get some tests for this.
Comment #3
klausiNow with tests. Could not find a suiting test class, so I created a new ExceptionControllerTest in system module.
Comment #5
klausiTest only patch fails as expected :-)
Comment #6
Crell CreditAttribution: Crell commentedI'm unclear how this is testing the behavior of the request. We're directly calling an internal method, on405Html, which is too deep. That's an implementation detail. Rather, we need to call the actual controller method of ExceptionController() and confirm that we get back the correct Response object.
Comment #7
klausiSure, now using the execute() method of the ExceptionController.
Comment #9
Crell CreditAttribution: Crell commentedThis needs to be new \Exception('Test exception').
Comment #10
klausiOf course, I thought the backslashes were optional but obviously PHP requires them.
Comment #11
Crell CreditAttribution: Crell commentedIn a namespaced file, classes sans-prefix are assumed to be in the current namespace if not "use"d. So PHP was converting "Exception" to "Drupal\system\Test\Exception, which of course doesn't exist.
Comment #12
webchickCommitted to 8.x. Will push at the end of my commit-spree.