Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1 incompatible with composer 2 #37

Open
cawolf opened this issue Nov 16, 2021 · 0 comments
Open

v1 incompatible with composer 2 #37

cawolf opened this issue Nov 16, 2021 · 0 comments
Labels
bug Something isn't working

Comments

@cawolf
Copy link

cawolf commented Nov 16, 2021

During our update from composer 1 to composer 2 we encountered issues with version 1.0.1 of this library.

Description

composer 1

When running composer dumpautoload -o with composer 1, you get this output:

Generating optimized autoload files
Deprecation Notice: Class NewRelic\Monolog\Enricher\AbstractFormatter located in ./vendor/newrelic/monolog-enricher/src/Formatter.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar:///tmp/newrelic/composer.phar/src/Composer/Autoload/ClassMapGenerator.php:201
Deprecation Notice: Class NewRelic\Monolog\Enricher\AbstractHandler located in ./vendor/newrelic/monolog-enricher/src/Handler.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar:///tmp/newrelic/composer.phar/src/Composer/Autoload/ClassMapGenerator.php:201
Generated optimized autoload files containing 122 classes

However, the class map is generated correctly:

grep -R AbstractHandler vendor/composer/autoload*
vendor/composer/autoload_classmap.php:    'Monolog\\Handler\\AbstractHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/AbstractHandler.php',
vendor/composer/autoload_classmap.php:    'NewRelic\\Monolog\\Enricher\\AbstractHandler' => $vendorDir . '/newrelic/monolog-enricher/src/Handler.php',
vendor/composer/autoload_static.php:        'Monolog\\Handler\\AbstractHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/AbstractHandler.php',
vendor/composer/autoload_static.php:        'NewRelic\\Monolog\\Enricher\\AbstractHandler' => __DIR__ . '/..' . '/newrelic/monolog-enricher/src/Handler.php',
grep -R AbstractFormatter vendor/composer/autoload*
vendor/composer/autoload_classmap.php:    'NewRelic\\Monolog\\Enricher\\AbstractFormatter' => $vendorDir . '/newrelic/monolog-enricher/src/Formatter.php',
vendor/composer/autoload_static.php:        'NewRelic\\Monolog\\Enricher\\AbstractFormatter' => __DIR__ . '/..' . '/newrelic/monolog-enricher/src/Formatter.php',

composer 2

When running composer dumpautoload -o with composer 2, you get this output:

Generating optimized autoload files
Class NewRelic\Monolog\Enricher\AbstractFormatter located in ./vendor/newrelic/monolog-enricher/src/Formatter.php does not comply with psr-4 autoloading standard. Skipping.
Class NewRelic\Monolog\Enricher\AbstractHandler located in ./vendor/newrelic/monolog-enricher/src/Handler.php does not comply with psr-4 autoloading standard. Skipping.
Generated optimized autoload files containing 121 classes

The class map is generated without references to the abstract classes:

grep -R AbstractHandler vendor/composer/autoload*
vendor/composer/autoload_classmap.php:    'Monolog\\Handler\\AbstractHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/AbstractHandler.php',
vendor/composer/autoload_static.php:        'Monolog\\Handler\\AbstractHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/AbstractHandler.php',
grep -R AbstractFormatter vendor/composer/autoload*

Steps to Reproduce

use composer 1 or 2 (see above)

composer require newrelic/monolog-enricher:1.0.1
composer dumpautoload -o

Expected Behaviour

No deprecation warnings with composer 1/2 and a complete optimized class map with composer 2.

Relevant Logs / Code Samples

Your Environment

PHP 8.0.2 (cli) (built: Feb 23 2021 14:52:59) ( NTS )

monolog/monolog 2.3.5 Sends your logs to files, sockets, inboxes, databases and various web services
newrelic/monolog-enricher 1.0.1 Monolog components to enable New Relic Logs

Linux AUX-LAP-200 5.4.0-90-generic #101-Ubuntu SMP Fri Oct 15 20:00:55 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04.3 LTS"

Additional context

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant