Following the issue on https://github.com/drush-ops/drush/issues/3380 which states a Kernel error 'Container cannot be saved to cache.' might occur when invoking drush updb we throw an additional error when asking for getRealMethod on 'null' (empty request stack).
Error: Call to a member function getRealMethod() on null in Drupal\jsonlog\Logger\JsonLog->prepareLog()
Although being an edge case we should check if we're dealing with a http-request before asking getRealMethod() on the RequestStack. Maybe we should also inject this RequestStack via DI instead of making the static call to Drupal::request().
Proposed solution is not trying to log the real method (GET,POST,..) if the actual request from context is unknown meaning an empty $context['request_uri'] or Drupal::request().
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | missing_request_info_throws_error_on_getRealMethod-2954891-3.patch | 8.51 KB | lorenzs |
Comments
Comment #2
lorenzs commentedComment #3
lorenzs commentedAttached patch solves this issue and also replaces deprecated getMock in Unit-tests.
I will add this in 1.1 release shortly.
Comment #5
jopdebeeck commentedFixed after patch was applied.
Comment #6
lorenzs commentedAvailable in release 8.x-1.1.