diff vendor/symfony/http-kernel/DataCollector/EventDataCollector.php @ 14:1fec387a4317

Update Drupal core to 8.5.2 via Composer
author Chris Cannam
date Mon, 23 Apr 2018 09:46:53 +0100
parents 4c8ae668cc8c
children 129ea1e6d783
line wrap: on
line diff
--- a/vendor/symfony/http-kernel/DataCollector/EventDataCollector.php	Mon Apr 23 09:33:26 2018 +0100
+++ b/vendor/symfony/http-kernel/DataCollector/EventDataCollector.php	Mon Apr 23 09:46:53 2018 +0100
@@ -27,6 +27,9 @@
 
     public function __construct(EventDispatcherInterface $dispatcher = null)
     {
+        if ($dispatcher instanceof TraceableEventDispatcherInterface && !method_exists($dispatcher, 'reset')) {
+            @trigger_error(sprintf('Implementing "%s" without the "reset()" method is deprecated since Symfony 3.4 and will be unsupported in 4.0 for class "%s".', TraceableEventDispatcherInterface::class, \get_class($dispatcher)), E_USER_DEPRECATED);
+        }
         $this->dispatcher = $dispatcher;
     }
 
@@ -41,12 +44,26 @@
         );
     }
 
+    public function reset()
+    {
+        $this->data = array();
+
+        if ($this->dispatcher instanceof TraceableEventDispatcherInterface) {
+            if (!method_exists($this->dispatcher, 'reset')) {
+                return; // @deprecated
+            }
+
+            $this->dispatcher->reset();
+        }
+    }
+
     public function lateCollect()
     {
         if ($this->dispatcher instanceof TraceableEventDispatcherInterface) {
             $this->setCalledListeners($this->dispatcher->getCalledListeners());
             $this->setNotCalledListeners($this->dispatcher->getNotCalledListeners());
         }
+        $this->data = $this->cloneVar($this->data);
     }
 
     /**