PHP Warning SplObjectStorage::offsetExists() expects parameter 1 to be object, null given Updating to 8.5.1 today from 8.4.5, and after a successful update, I start getting the following warnings on every page:

Warning: SplObjectStorage::offsetExists() expects parameter 1 to be object, null given in /var/www/docroot/core/lib/Drupal/Core/Render/Renderer.php on line 602

Warning: SplObjectStorage::offsetSet() expects parameter 1 to be object, null given in /var/www/docroot/core/lib/Drupal/Core/Render/Renderer.php on line 616

Warning: SplObjectStorage::offsetExists() expects parameter 1 to be object, null given in /var/www/docroot/core/lib/Drupal/Core/Render/Renderer.php on line 602


core/lib/Drupal/Core/Render/Renderer.php lines 594 - 618:

/**
   * Returns the current render context.
   *
   * @return \Drupal\Core\Render\RenderContext
   *   The current render context.
   */
  protected function getCurrentRenderContext() {
    $request = $this-&gt;requestStack-&gt;getCurrentRequest();
    return isset(static::$contextCollection[$request]) ? static::$contextCollection[$request] : NULL;
  }

  /**
   * Sets the current render context.
   *
   * @param \Drupal\Core\Render\RenderContext|null $context
   *   The render context. This can be NULL for instance when restoring the
   *   original render context, which is in fact NULL.
   *
   * @return $this
   */
  protected function setCurrentRenderContext(RenderContext $context = NULL) {
    $request = $this-&gt;requestStack-&gt;getCurrentRequest();
    static::$contextCollection[$request] = $context;
    return $this;
  }


docroot/vendor/symfony/http-foundation/RequestStack.php line 56 - 62:

/**
 * @return Request|null
 */
public function getCurrentRequest()
{
    return end($this-&gt;requests) ?: null;
}


If I dump $this-&gt;requests it is an empty array at this point that is causing the SplObjectStorage errors.  I am brand new to Symfony and I do not know how to proceed with troubleshooting. Any suggestions would be welcome.

EDIT 1:

It looks like it might be an issue with the Shield module. 

PHP message: Failed to log error: 
Notice: Undefined variable: user in Drupal\\shield\\ShieldMiddleware-&gt;handle() 
(line 79 of /var/www/docroot/modules/contrib/shield/src/ShieldMiddleware.php). 

  #0 /var/www/docroot/core/includes/bootstrap.inc(582): _drupal_error_handler_real(8, 'Undefined varia...', '/var/www/docroo...', 79, Array)

  #1 /var/www/docroot/modules/contrib/shield/src/ShieldMiddleware.php(79): _drupal_error_handler(8, 'Undefined varia...', '/var/www/docroo...', 79, Array)

  #2 /var/www/docroot/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\\shield\\ShieldMiddleware-&gt;handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)

  #3 /var/www/docroot/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(50): Drupal\\Core\\StackMiddleware\\ReverseProxyMiddleware-&gt;handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)

  #4 /var/www/docroot/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\\Core\\StackMiddleware\\NegotiationMiddleware-&gt;handle(Object(Sy...',
I was able to get this error to go away by deleting my entire project and rebuilding from scratch.  Was not ever able to identify the source for the warnings, so if you come here looking for answers, best of luck.  If you find any, please share!