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

Load API files relative to the ComposerBootstrap.php instead of the ddtrace autoloader #2013

Merged
merged 2 commits into from
Apr 13, 2023

Conversation

bwoebi
Copy link
Collaborator

@bwoebi bwoebi commented Apr 12, 2023

Description

Fixing an issue with preloading.

The current code assumes a src/ directory exists next to the ddtrace bridge, which is not the case in actually installed environments.

Readiness checklist

  • (only for Members) Changelog has been added to the release document.
  • Tests added for this feature/bug.

Reviewer checklist

  • Appropriate labels assigned.
  • Milestone is set.
  • Changelog has been added to the release document. For community contributors the reviewer is in charge of this task.

@bwoebi bwoebi added this to the 0.87.0 milestone Apr 12, 2023
@bwoebi bwoebi requested a review from a team as a code owner April 12, 2023 16:48
@bwoebi bwoebi force-pushed the bob/fix-composer-autoload-preload branch from 7716fec to 189b952 Compare April 12, 2023 16:50
…dtrace autoloader

The current code assumes a src/ directory exists next to the ddtrace bridge, which is not the case in actually installed environments.

Signed-off-by: Bob Weinand <bob.weinand@datadoghq.com>
@bwoebi bwoebi force-pushed the bob/fix-composer-autoload-preload branch from 189b952 to 544238e Compare April 12, 2023 16:57
@@ -41,10 +41,12 @@
return;
}

$base_dir = __DIR__ . '/../src/api/';
// All API files are in the same directory as the ComposerBootstrap file
$bootstrapClass = new ReflectionClass('DDTrace\ComposerBootstrap');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will throw if the class isn't found. This is guarded by the above if, but I'd be happier if they used a variable or a constant or something so it's harder to get accidentally get them out-of-sync.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a variable :-)

@bwoebi bwoebi merged commit 0727544 into master Apr 13, 2023
@bwoebi bwoebi deleted the bob/fix-composer-autoload-preload branch April 13, 2023 08:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants