Closed N-Molham closed 1 year ago
I've not come across this one myself. I'd accept a PR that fixes this.
@freekmurze I am not sure what is the fix ... did you try to replicate it?
Unfortunately I don't know how to fix this. This has something to do in the exotic way Composer is being used in WordPress.
I welcome a PR that fixes this by someone who is more knowledgable than me about the Wordpress internals.
When multiple plugin include the same packages, with with different versions, then issues may arrise.
In theory, this could also happen to Drupal or whatever platform that doesn't have 1 central composer.json, but loads PHP package by them self, if I'm correct.
I know some projects that have a solution to wrap all third party packages in their own namespace to prevent conflicts like this. E.g https://github.com/coenjacobs/mozart or https://github.com/humbug/php-scoper (see https://github.com/Yoast/wordpress-seo/blob/trunk/composer.json#L109-L120)
So I think the conflict / solution lies in both plugins and it's more of an architectural thingy with composer and platforms like WordPress that don't have 1 central package manager for all the code.
Kind regards,
Jaime
@jmslbam That's exactly why this plugin uses PHP Scoper. I believe Yoast SEO uses this too.
@jmslbam That's exactly why this plugin uses PHP Scoper. I believe Yoast SEO uses this too.
Ah, oeps, sorry. I looked over that!
Maybe that @N-Molham could try and use PHP Scoper and see if it solves his issue.
@freekmurze @jmslbam @jeffreyvr PHP Scoper could be a good idea, but the thing is Sentry is a standalone SDK So, Maybe it would be ideal if the Ray's plugin implements it, so it would also avoid conflicts with other plugins using composer as well.
@N-Molham Probably we won't do this as we use a lot of vendor code. Not being able to composer would make development of all other Ray clients much harder. This is currently something I'm not willing to do, as most PHP projects do play nice with Composer.
Describe the bug An
OutOfBoundsException
exception get throws while loading my WordPress plugin which has Sentry SDK which in turns hasjean85/pretty-package-versions
as dependency.Versions Ray plugin version 1.3.2
PHP version: 7.4
To Reproduce Steps to reproduce the behavior:
composer require sentry/sdk
plugins_loaded
action hookOutOfBoundsException
when Sentry trying to check the installed SDK version.Expected behavior When a plugin has
jean85/pretty-package-versions
it should not conflict with Ray's plugin and cause an exceptionScreenshots The screenshot is from Ray app which helped me debug the problem (well done)![image](https://user-images.githubusercontent.com/3770036/128335290-ac619d77-82bf-4e2b-b962-faf930b992af.png)
Desktop (please complete the following information):
Version: 1.17.0
Additional context I guess this could happen with any other app, not just WordPress CMS