-
Notifications
You must be signed in to change notification settings - Fork 223
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
Namespace external package dependencies to avoid conflicts with other plugins/theme using the same package but different version. #3005
Comments
Some example from another plugin using php-scoper: https://github.com/mundschenk-at/wp-typography/blob/master/composer.json#L88 https://plugins.trac.wordpress.org/browser/wp-typography/trunk/vendor-scoped |
Probably more work to maintain and update in this case (just my opinion). |
On a quick review of those tools mentioned/linked, I think our support of PHP 5.6 will rule out both php-scoper and imposter, as they both require at least 7.2. Mozart seems like it could work, as it requires 7.2 to run on composer, but can handle packages using < 7, BUT it is still an experimental package with it's own warning about "wearing a hard hat for use in production". Not good with a million sites relying on stability. :( I think our best solution (for now) is likely to re-namespace our other dependencies into Engine, as we did for league/container. This requires some additional maintenance overhead, as we'd have to track the packages ourselves, but as we move into the new roadmap and get significant parts of the plugin out of the plugin :) it should be less cumbersome over time, until we can either drop 5.6 or Mozart stabilizes. |
@DanielRuf Your point is valid. It does add work for releases as we have to manually check and update each dependency. Definitely not optimal.
We're using Mozart on our standalone LazyLoad plugin. We have support tickets with a similar League Container fatal error. At the moment, we're not sure yet of the root cause. However, @iCaspar your point is valid. "Experimental" is not stable or robust enough for our customers. This is why we pulled the League Container into Rocket's Engine as it's a critical component to Rocket. |
Not sure but to me it looks like the dependencies are twice in there. In the default vendor folder with the autoloader: In src/Dependencies: And I guess depending on the used loader it is a different path: https://plugins.trac.wordpress.org/browser/rocket-lazy-load/trunk/vendor/composer/autoload_real.php This is just an assumption as I've never used mozart and only used php-scoper in projects.
|
@DanielRuf Great catch. You pointed us in the right direction from which I created this issue. Thank you! |
As we experienced with the WooCommerce container conflict #3003 and here, when other plugins/themes use the same external composer dependencies but with a different version, the risk is high for a fatal error conflict. We can mitigate this risk by encapsulating each production-level dependency with a namespace.
There are multiple ways to accomplish this including:
Let's be proactive to guard Rocket and our customers from this happening again.
The text was updated successfully, but these errors were encountered: