When I open profiler for database, I see

Warning: Illegal string offset 'status_code' in Drupal\webprofiler\DataCollector\RequestDataCollector->getPanelSummary() (line 74 of modules/contrib/devel/webprofiler/src/DataCollector/RequestDataCollector.php).
Drupal\webprofiler\DataCollector\RequestDataCollector->getPanelSummary() (Line: 122)
Drupal\webprofiler\Controller\DashboardController->dashboardAction(Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 574)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
call_user_func_array(Object, Array) (Line: 153)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 99)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 78)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 38)
Drupal\webprofiler\StackMiddleware\WebprofilerMiddleware->handle(Object, 1, 1) (Line: 50)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 656)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Warning: Illegal string offset 'status_text' in Drupal\webprofiler\DataCollector\RequestDataCollector->getPanelSummary() (line 74 of modules/contrib/devel/webprofiler/src/DataCollector/RequestDataCollector.php).
Drupal\webprofiler\DataCollector\RequestDataCollector->getPanelSummary() (Line: 122)
Drupal\webprofiler\Controller\DashboardController->dashboardAction(Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 574)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
call_user_func_array(Object, Array) (Line: 153)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 99)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 78)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 38)
Drupal\webprofiler\StackMiddleware\WebprofilerMiddleware->handle(Object, 1, 1) (Line: 50)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 656)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

LOBsTerr created an issue. See original summary.

lussoluca’s picture

Status: Active » Postponed (maintainer needs more info)

Could you please provide some more information?
Which web server are you using, which kind of request you are trying to profile?

LOBsTerr’s picture

@lussoluca

I'm using nginx version: nginx/1.10.3 (Ubuntu).
Actually, it happens on every page.
I tried to debug it. in $this->data I receive the string instead of array:

/usr/share/nginx/html/dr8_dev/modules/contrib/devel/webprofiler/src/DataCollector/RequestDataCollector.php:74:string '[
  method => GET, 
  format => html, 
  content => , 
  content_type => text/html; charset=UTF-8, 
  status_text => OK, 
  status_code => 200, 
  request_query => [], 
  request_request => [], 
  request_headers => [
...

I will continue to debug and will provide more information at what moment it is converted to string.

LOBsTerr’s picture

Status: Postponed (maintainer needs more info) » Active

So, after an active debugging process I finally was able to find it.
The value is stored in database and it is stored as a serialized string and it comes there as an string already

{s:4494:"[
  method => GET, 
  format => html, 
  content => , 
  content_type => text/html; charset=UTF-8, 
  status_text => Not Found, 
  status_code => 404, 
  request_query => [
    q => /modules/contrib/devel/webprofiler/css/app/dashboard.css.map
  ], 

So, I started to check it and found Symfony\Component\HttpKernel\DataCollector\lateCollect()
which converts $this->data to cloneVar and as the result it returns a string.

I have checked 8.3. There the version "symfony/http-kernel": "^2.2|3.*" is used and this code does not exist there.
Where as in 8.4 the version is "symfony/http-kernel": "~2.7|~3.0".

lussoluca’s picture

Are you on drupal 8.4.x?

LOBsTerr’s picture

Yes, check my comment above. I have just updated the information.

lussoluca’s picture

Priority: Normal » Major
adriancid’s picture

In my Drupal 8.4.4 the module works fine, I come from update to 8.5 and I see this error and the Request section is not working due to this error.

lussoluca’s picture

So, I started to check it and found Symfony\Component\HttpKernel\DataCollector\lateCollect()
which converts $this->data to cloneVar and as the result it returns a string.

Yes this is the problem, but I don't understand why the unserialize doesn't recreate the array back. A quick fix is to override the lateCollect() method to avoid the data conversion.

Status: Needs review » Needs work

The last submitted patch, 9: devel-fix-RequestDataCollector-2897792-9.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

rajanvalecha12’s picture

after applying this patch i get :

"LogicException: The database connection is not serializable. This probably means you are serializing an object that has an indirect reference to the database connection. Adjust your code so that is not necessary. Alternatively, look at DependencySerializationTrait as a temporary solution. in Drupal\Core\Database\Connection->__sleep() (line 1472 of /Applications/MAMP/htdocs/drupal_exp/core/lib/Drupal/Core/Database/Connection.php) #0 [internal function]: Drupal\Core\Database\Connection->__sleep() #1 /Applications/MAMP/htdocs/drupal_exp/vendor/symfony/http-kernel/DataCollector/DataCollector.php(45): serialize(Array) #2 [internal function]: Symfony\Component\HttpKernel\DataCollector\DataCollector->serialize() #3 /Applications/MAMP/htdocs/drupal_exp/modules/contrib/devel/webprofiler/src/Profiler/DatabaseProfilerStorage.php(101): serialize(Array) #4 /Applications/MAMP/htdocs/drupal_exp/vendor/symfony/http-kernel/Profiler/Profiler.php(105): Drupal\webprofiler\Profiler\DatabaseProfilerStorage->write(Object(Symfony\Component\HttpKernel\Profiler\Profile)) #5 /Applications/MAMP/htdocs/drupal_exp/vendor/symfony/http-kernel/EventListener/ProfilerListener.php(113): Symfony\Component\HttpKernel\Profiler\Profiler->saveProfile(Object(Symfony\Component\HttpKernel\Profiler\Profile)) #6 /Applications/MAMP/htdocs/drupal_exp/modules/contrib/devel/webprofiler/src/EventDispatcher/TraceableEventDispatcher.php(76): Symfony\Component\HttpKernel\EventListener\ProfilerListener->onKernelTerminate(Object(Symfony\Component\HttpKernel\Event\PostResponseEvent), 'kernel.terminat...', Object(Drupal\webprofiler\EventDispatcher\TraceableEventDispatcher)) #7 /Applications/MAMP/htdocs/drupal_exp/vendor/symfony/http-kernel/HttpKernel.php(88): Drupal\webprofiler\EventDispatcher\TraceableEventDispatcher->dispatch('kernel.terminat...', Object(Symfony\Component\HttpKernel\Event\PostResponseEvent)) #8 /Applications/MAMP/htdocs/drupal_exp/vendor/stack/builder/src/Stack/StackedHttpKernel.php(32): Symfony\Component\HttpKernel\HttpKernel->terminate(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\LocalRedirectResponse)) #9 /Applications/MAMP/htdocs/drupal_exp/core/lib/Drupal/Core/DrupalKernel.php(644): Stack\StackedHttpKernel->terminate(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\LocalRedirectResponse)) #10 /Applications/MAMP/htdocs/drupal_exp/index.php(22): Drupal\Core\DrupalKernel->terminate(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\LocalRedirectResponse)) #11 {main}."

at /admin/modules/uninstall

  • lussoluca committed 1daa125 on 8.x-1.x
    Issue #2897792 by lussoluca: Warning Illegal string offset 'status_code...
lussoluca’s picture

Status: Needs work » Fixed

I cannot replicate the serialization error so I'm going to close this for now.
Feel free to open a new issue if some other errors occur

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

sami-an’s picture

Warning: Illegal string offset 'status_text' in Symfony

ilgnerfagundes’s picture

Good morning, I received this error when trying to enter any of the reports. I am using drupal core 8.8.2 and Webprofiler 8.x-2.1. Using this environment with postgree https://hub.docker.com/_/drupal

Warning: Illegal string offset 'status_code' in Drupal\webprofiler\DataCollector\RequestDataCollector->getPanelSummary() (line 75 of sites/default/modules/contrib/devel-8.x-2.1/devel/webprofiler/src/DataCollector/RequestDataCollector.php).
Drupal\webprofiler\DataCollector\RequestDataCollector->getPanelSummary() (Line: 122)
Drupal\webprofiler\Controller\DashboardController->dashboardAction(Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 573)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 151)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 38)
Drupal\webprofiler\StackMiddleware\WebprofilerMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 694)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Warning: Illegal string offset 'status_text' in Drupal\webprofiler\DataCollector\RequestDataCollector->getPanelSummary() (line 75 of sites/default/modules/contrib/devel-8.x-2.1/devel/webprofiler/src/DataCollector/RequestDataCollector.php).
Drupal\webprofiler\DataCollector\RequestDataCollector->getPanelSummary() (Line: 122)
Drupal\webprofiler\Controller\DashboardController->dashboardAction(Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 573)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 151)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 38)
Drupal\webprofiler\StackMiddleware\WebprofilerMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 694)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Warning: file_get_contents(libraries/d3/d3.min.js): failed to open stream: No such file or directory in _locale_parse_js_file() (line 1133 of core/modules/locale/locale.module).
_locale_parse_js_file('libraries/d3/d3.min.js') (Line: 547)
locale_js_translate(Array) (Line: 507)
locale_js_alter(Array, Object, NULL) (Line: 539)
Drupal\Core\Extension\ModuleHandler->alter('js', Array, Object) (Line: 276)
Drupal\Core\Asset\AssetResolver->getJsAssets(Object, ) (Line: 322)
Drupal\Core\Render\HtmlResponseAttachmentsProcessor->processAssetLibraries(Object, Array) (Line: 161)
Drupal\Core\Render\HtmlResponseAttachmentsProcessor->processAttachments(Object) (Line: 94)
Drupal\big_pipe\Render\BigPipeResponseAttachmentsProcessor->processAttachments(Object) (Line: 45)
Drupal\Core\EventSubscriber\HtmlResponseSubscriber->onRespond(Object, 'kernel.response', Object) (Line: 76)
Drupal\webprofiler\EventDispatcher\TraceableEventDispatcher->dispatch('kernel.response', Object) (Line: 191)
Symfony\Component\HttpKernel\HttpKernel->filterResponse(Object, Object, 1) (Line: 173)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 38)
Drupal\webprofiler\StackMiddleware\WebprofilerMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 694)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Warning: file_get_contents(libraries/highlightjs/highlight.pack.js): failed to open stream: No such file or directory in _locale_parse_js_file() (line 1133 of core/modules/locale/locale.module).
_locale_parse_js_file('libraries/highlightjs/highlight.pack.js') (Line: 547)
locale_js_translate(Array) (Line: 507)
locale_js_alter(Array, Object, NULL) (Line: 539)
Drupal\Core\Extension\ModuleHandler->alter('js', Array, Object) (Line: 276)
Drupal\Core\Asset\AssetResolver->getJsAssets(Object, ) (Line: 322)
Drupal\Core\Render\HtmlResponseAttachmentsProcessor->processAssetLibraries(Object, Array) (Line: 161)
Drupal\Core\Render\HtmlResponseAttachmentsProcessor->processAttachments(Object) (Line: 94)
Drupal\big_pipe\Render\BigPipeResponseAttachmentsProcessor->processAttachments(Object) (Line: 45)
Drupal\Core\EventSubscriber\HtmlResponseSubscriber->onRespond(Object, 'kernel.response', Object) (Line: 76)
Drupal\webprofiler\EventDispatcher\TraceableEventDispatcher->dispatch('kernel.response', Object) (Line: 191)
Symfony\Component\HttpKernel\HttpKernel->filterResponse(Object, Object, 1) (Line: 173)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 38)
Drupal\webprofiler\StackMiddleware\WebprofilerMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 694)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)