Skip to content

psr/log causes errors on the Sage 11 theme #3220

@Dyras

Description

@Dyras

Describe the bug:

I'm using Sage 11 on a Trellis site. Since psr/log (seemingly) isn't namespaced it collides with the pre-installed psr/log in the theme.

Steps to reproduce:

  1. Set up a website with Sage 11, Acorn, Trellis. The entire Roots stack really
  2. Try to pre-cache the site using "wp acorn optimize"
  3. You get this error:

   Psr\Log\InvalidArgumentException 

  Level "\Monolog\Level::Debug" is not defined, use one of: 100, 200, 250, 300, 400, 500, 550, 600, DEBUG, INFO, NOTICE, WARNING, ERROR, CRITICAL, ALERT, EMERGENCY

  at public/content/plugins/google-listings-and-ads/vendor/monolog/monolog/src/Monolog/Logger.php:520
    516▕             throw new InvalidArgumentException('Level "'.$level.'" is not defined, use one of: '.implode(', ', array_keys(static::$levels) + static::$levels));
    517▕         }
    518▕ 
    519▕         if (!is_int($level)) {
  ➜ 520▕             throw new InvalidArgumentException('Level "'.var_export($level, true).'" is not defined, use one of: '.implode(', ', array_keys(static::$levels) + static::$levels));
    521▕         }
    522▕ 
    523▕         return $level;
    524▕     }

      +23 vendor frames 
  24  phar:///usr/bin/wp/php/boot-phar.php:20
  25  /usr/bin/wp:4

Expected behavior:

psr/log and everything else for that matter should be namespaced so that they don't collide with anything else.

Actual behavior:

They aren't which prevents some things from working using the Sage 11 theme and presumably also with other plugins that don't namespace psr/log

Additional details:

Info about the issue:
https://roots.io/acorn/docs/compatibility/

Similar issue with Cloudflare's plugin that they recently fixed:
cloudflare/Cloudflare-WordPress#554

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions