File tree Expand file tree Collapse file tree 3 files changed +34
-1
lines changed
tests/Integration/Composer Expand file tree Collapse file tree 3 files changed +34
-1
lines changed Original file line number Diff line number Diff line change 207207 " OpenTelemetry\\ Tests\\ Integration\\ SDK\\ Common\\ Configuration\\ TestEnvSourceProvider"
208208 ]
209209 }
210+ },
211+ "scripts" : {
212+ "test-psr3" : [
213+ " OpenTelemetry\\ Tests\\ Integration\\ Composer\\ Psr3CompatabilityTest::run"
214+ ]
210215 }
211216}
Original file line number Diff line number Diff line change 22
33declare (strict_types=1 );
44
5- \OpenTelemetry \SDK \SdkAutoloader::autoload ();
5+ /**
6+ * If OTEL_PHP_AUTOLOAD_ENABLED=true, there may be compatability issues
7+ * if the version of PSR-3 installed in ./vendor conflicts with that of the
8+ * packaged composer PSR-3 library.
9+ *
10+ * If COMPOSER_DEV_MODE is present, then we can assume that a composer script
11+ * is running, and we can prevent the PSR-3 compatability issues by disabling
12+ * the SDK from activating.
13+ *
14+ * @see https://github.com/open-telemetry/opentelemetry-php/issues/1673
15+ */
16+ if (getenv ('COMPOSER_DEV_MODE ' ) === false ) {
17+ \OpenTelemetry \SDK \SdkAutoloader::autoload ();
18+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ namespace OpenTelemetry \Tests \Integration \Composer ;
6+
7+ use Composer \Script \Event ;
8+
9+ final class Psr3CompatabilityTest
10+ {
11+ public static function run (Event $ event ): void
12+ {
13+ require_once $ event ->getComposer ()->getConfig ()->get ('vendor-dir ' ).'/autoload.php ' ;
14+ }
15+ }
You can’t perform that action at this time.
0 commit comments