Make compilation to single file compatible with include __DIR__ . '...'
in files
#943
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Problem
For performance reasons, we compile all our files into a single file that is then served from the
bridge
folder. The problem with this is that in 3 classes of files in our code base relies oninclude __DIR__ . '...';
. During compilation__DIR__
is replaced with the actual absolute path of the machine when compilation happens, e.g./home/circleci/datadog/...
. This is clearly not compatible with our deployments that are installed in either/opt/...
or any custom folder the user likes.Which types of files and who is impacted?
Only users on PHP 5.4, because
try_catch_finally.php
include. Hence only users on PHP 5.4 are impacted as the new sandboxed integrations are not using this mechanism.Tracer::version()
method: this impact no one in production, it only breaks one line indd-doctor.php
.What is the short term proposal?
After we generate the dingle file, we change all absolute import from bridge to the bridge dir itself.
What is the long term proposal?
Tracer::version()
check which was only used to compare composer vs ext versions. This is now no longer requested after we are providing the noop classes insrc/api
.What other options where tried
--skip_dir_file
,--fix_dir
and--fix_files
from https://github.com/ClassPreloader/ClassPreloader but the problem is that even relative paths from bridge would be different in dev and in production.Why we did not catch in tests and what we will do?
When executing tests locally and in CI, we build in the same machine where we execute tests, so files happen to be there accidentally. We were using those files without even realizing.
Readiness checklist
Reviewer checklist