summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlussoluca2018-07-03 10:46:27 (GMT)
committerLuca Lusso2018-07-03 10:46:27 (GMT)
commit1daa125ac41da037e50a2ec838c74dc6842dd879 (patch)
tree02ab4a0906c03b2059c1cd5f047677c7676052b9
parente41485e2663b783d926be9eb9c9123b21a0e40bd (diff)
Issue #2897792 by lussoluca: Warning Illegal string offset 'status_code' and 'status_text' on database profiler page
-rw-r--r--webprofiler/src/DataCollector/DrupalDataCollectorTrait.php7
-rw-r--r--webprofiler/src/DataCollector/RequestDataCollector.php17
2 files changed, 23 insertions, 1 deletions
diff --git a/webprofiler/src/DataCollector/DrupalDataCollectorTrait.php b/webprofiler/src/DataCollector/DrupalDataCollectorTrait.php
index 98a3faf..a523644 100644
--- a/webprofiler/src/DataCollector/DrupalDataCollectorTrait.php
+++ b/webprofiler/src/DataCollector/DrupalDataCollectorTrait.php
@@ -10,6 +10,13 @@ trait DrupalDataCollectorTrait {
/**
* {@inheritdoc}
*/
+ public function reset() {
+ $this->data = array();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
public function getPanelSummary() {
return NULL;
}
diff --git a/webprofiler/src/DataCollector/RequestDataCollector.php b/webprofiler/src/DataCollector/RequestDataCollector.php
index 9de8f49..229a632 100644
--- a/webprofiler/src/DataCollector/RequestDataCollector.php
+++ b/webprofiler/src/DataCollector/RequestDataCollector.php
@@ -52,6 +52,8 @@ class RequestDataCollector extends BaseRequestDataCollector implements DrupalDat
* @param $service_id
* @param $callable
* @param $request
+ *
+ * @throws \ReflectionException
*/
public function addAccessCheck($service_id, $callable, Request $request) {
$this->accessCheck[$request->getPathInfo()][] = [
@@ -62,6 +64,19 @@ class RequestDataCollector extends BaseRequestDataCollector implements DrupalDat
/**
* {@inheritdoc}
+ *
+ * In Symfony 3 the data for the RequestDataCollector are converted to string
+ * with \Symfony\Component\HttpKernel\DataCollector/DataCollector::cloneVar()
+ * in
+ * \Symfony\Component\HttpKernel\DataCollector\RequestDataCollector::lateCollect(),
+ * but for some reasons they aren't unserialized back to array later. At the
+ * moment we simply override that method to avoid conversion.
+ */
+ public function lateCollect() {
+ }
+
+ /**
+ * {@inheritdoc}
*/
public function getTitle() {
return $this->t('Request');
@@ -71,7 +86,7 @@ class RequestDataCollector extends BaseRequestDataCollector implements DrupalDat
* {@inheritdoc}
*/
public function getPanelSummary() {
- return $this->data['status_code'].' '.$this->data['status_text'];
+ return $this->data['status_code'] . ' ' . $this->data['status_text'];
}
/**