fix: WC_STRIPE_PLUGIN_URL when pointing to symbolic link #3029
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.
Changes proposed in this Pull Request:
Description: Fixes an esoteric bug that only seems to happen when the plugin is installed in a server location that is both unavailable for public HTTP requests and then symlinked to the
wp-content/plugins
folder. Some hosts have a directory structure like this in order to manage plugin versions across multiple sites from a single server directory.In this scenario, the
WC_STRIPE_PLUGIN_URL
constant will include the path to the inaccessible server directory instead of thewp-content/plugins
directory, potentially resulting in 400 errors when fetching CSS and JS assets using this constant. The resulting errors break user-facing functionality at the point of checkout.Not sure how this could be unit-tested, but open to adding if you think it's necessary.
Testing instructions
8.0.1
).cd
into thewp-content/plugins
directory and create a symbolic link to the "true" location of the plugin:ln -s <absolute path to source directory>/8.0.1 woocommerce-gateway-stripe
var_dump( WC_STRIPE_PLUGIN_URL );
after line 31 of./woocommerce-gateway-stripe.php
.develop
, visit your site's front-end and observe that theWC_STRIPE_PLUGIN_URL
constant points to the source directory's parent directory instead of the symlinked directory:https://<site URL>/wp-content/plugins/woocommerce-gateway-stripe
) and that you can now complete checkout on the front-end.changelog.txt
andreadme.txt
(or does not apply)Post merge