Skip to content

Fatal Error: Class name collision between main project's Psr\Log\AbstractLogger and Rollbar plugin's namespaced version #147

@jbrunemann

Description

@jbrunemann

The Rollbar WordPress plugin uses PHP-Scoper to namespace all dependencies under RollbarWP\ to avoid conflicts. However, the generated Composer autoloader files (autoload_psr4.php and autoload_static.php) were incorrectly registering the un-prefixed namespaces (Psr\Log\ and Monolog) instead of the prefixed versions (RollbarWP\Psr\Log\ and RollbarWP\Monolog).

This caused both my autoloaders (main project + Rollbar plugin) to register handlers for the same Psr\Log\ namespace, resulting in the fatal error when trying to load Psr\Log\AbstractLogger.

Original error:
Fatal error: Cannot declare class RollbarWP\Psr\Log\AbstractLogger, because the name is already in use in plugins/rollbar/vendor/psr/log/src/AbstractLogger.php on line 13

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions