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.
This is the last remaining puzzle piece after
+ will most likely help us to fix #1908310: Drupal without DB but with site config throws uninformative error
Comment | File | Size | Author |
---|---|---|---|
#10 | drupal8.error-handler-container.10.patch | 1.91 KB | sun |
#6 | request.png | 17.76 KB | dawehner |
drupal8.error-handler-container.0.patch | 1.2 KB | sun | |
Comments
Comment #1
sunComment #3
sundrupal8.error-handler-container.0.patch queued for re-testing.
Comment #4
dawehner#2160655: Improve error handling of \Drupal class seems also to be an related.
In general hasService('request') seems to also return TRUE, if the request is not set yet onto the container, see Container::has() and getRequestService() on the container. Maybe we should fill an upstream bug report?
At least for request we might actually want to use IntrospectableContainerInterface::initialized() instead?
Comment #5
sunI'm not sure how that would look code-wise in this function? — bear in mind that we can't make any assumptions or rely on anything in the error handler.
For now, I'd recommend to go ahead with this patch; it certainly resolves the last remaining WTFs in our procedural error handler.
In the end, this entire code will (hopefully) be replaced by completely new error/exception handler code in (or attached to)
DrupalKernel
.Comment #6
dawehnerWell, there is a semantic difference between has and initialized. While it does not matter for most services it does matter for the request one, see the attached screenshot.
so if we fail during booting or don't have a request at all, we might not fix those issues.
Given that has('request') will always return TRUE we could at least try to check for IntrospectableContainerInterface.
Comment #7
dawehnerYou cannot argue against that, sure.
Comment #8
sunIf I get you right, then we'd have to amend that condition to be
?
Comment #9
dawehnerWe do we not simply use something like:
Comment #10
sunOK, a helper method on \Drupal makes sense to me. Let's simply do both for now? We can always adjust it later. :-)
Comment #11
dawehner+1 for now.
Comment #12
dawehner+1 for now.
Comment #13
alexpottCommitted e71d749 and pushed to 8.x. Thanks!