Resolve intermittent issues finding templates in the phar#5962
Closed
johnpbloch wants to merge 1 commit intowp-cli:mainfrom
Closed
Resolve intermittent issues finding templates in the phar#5962johnpbloch wants to merge 1 commit intowp-cli:mainfrom
johnpbloch wants to merge 1 commit intowp-cli:mainfrom
Conversation
This was referenced Jul 13, 2024
Member
|
From wp-cli/wp-cli-bundle#649:
|
Member
|
I believe this was ultimately fixed in wp-cli/wp-cli-bundle#752 for v2.12.0. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #5907
I left a comment on that issue diving deeper into what the root of the problem seems to be.
Basically, if the phar isn't named
wp-cli.pharin the outer filesystem, then the phar itself won't be able to find things like templates in the inner filesystem when they're using__DIR__as a reference point.This has a companion change in wp-cli/wp-cli-bundle that will be coming shortly. That change will set the outer filesystem's filename in a constant inside boot-phar.php. This change checks for the presence of that constant before trying to use it, so there shouldn't be any issues affecting alternative installation/compilation strategies. If the constant exists, it looks for it as a full node in the phar-safe path and if found, replaces it with wp-cli.phar.
I noticed there weren't any tests for
phar_safe_path(), so I started to write some, but with all the reliance on constants that was already there, it quickly became too difficult even to test the previous functionality, let alone the change. If someone could point me in the right direction of a way to run functional tests on a built phar, that may be an easier way to test this change.