0

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->requestStack->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->requestStack->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->requests) ?: null;
}

If I dump $this->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->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->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)

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

  #4 /var/www/docroot/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\\Core\\StackMiddleware\\NegotiationMiddleware->handle(Object(Sy...', 
0

I got the same error after updating to Drupal 8.4.0, but only after importing the split configuration for my development environment.

After seeing the note above about a possible issue with the shield module, I checked the configuration page for the module and found that not all the shield module configuration fields were showing. I then uninstalled and then reinstalled the shield module.

New error messages have not appeared in the log nor on the screen after doing this.

Note: I have three configuration splits and had to uninstall and reinstall on the dev and test splits to fix this. The live split was OK. I also exported the update configuration for the shield module to each configuration split.

One other note: It could be that the configuration for the shield module did not get save to some of my configuration splits. If the shield module (and possibly other modules) cannot handle these values not being set it could be what is leading to these errors.

  • I totally forgot to update again after I fixed the issue. There, apparently, was an issue with the shield module after the 8.4.6 -> 8.5.1 upgrade where the username and password were lost somehow. Uninstalling and reinstalling the shield module fixed the issue permanently. – LukeSkywalker Apr 6 '18 at 14:41
0

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!

0

I received this today on my test server (XAMPP with composer)
It allowed me to 'Clear Cache' and after clearing the Cache the error is gone. Apparently my updating and/or removing a module needed me to clear the cache.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.