Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Undefined index errorCount at LoggerDataCollector #36159

Copy link
Copy link
Closed
@dbalabka

Description

@dbalabka
Issue body actions

Symfony version(s) affected: >=3.4.37

Description
The following error might appear which blocks Debug Toolbar to be loaded:

Uncaught PHP Exception ErrorException: "Notice: Undefined index: errorCount" at /Users/torinaki/www/htdocs/fithealthy2/vendor/symfony/http-kernel/DataCollector/LoggerDataCollector.php line 190

How to reproduce
TBD

@trigger_error("1", E_USER_DEPRECATED)

Such a log message might be thrown by:
https://github.com/symfony/symfony/blob/3.4/src/Symfony/Component/Config/Definition/ArrayNode.php#L238
in case if configuration child is deprecated and depreciation message for some reason is "1"

Possible Solution
Fix logic of:

private function sanitizeLogs(array $logs)

  1. There no guarantee that "errorCount" exists but it is not a root cause.
    $sanitizedLogs[$message]['errorCount'] += $exception->count;
  2. $sanitizedLogs contains numeric and assoc. keys. It should be avoided:

    $sanitizedLogs[$message]['errorCount'] += $exception->count;

Additional Context
It happened because of incorrect passed deprecation message:
https://github.com/Sylius/SyliusMailerBundle/blob/1.4/src/Bundle/DependencyInjection/Configuration.php#L76
It was possible because of missing type hint:
https://github.com/symfony/symfony/blob/3.4/src/Symfony/Component/Config/Definition/BaseNode.php#L170
which is fixed in 5.0 version of Symfony:
https://github.com/symfony/symfony/blob/5.0/src/Symfony/Component/Config/Definition/BaseNode.php#L204

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.