sentry-php icon indicating copy to clipboard operation
sentry-php copied to clipboard

sdk have issue with multiple composer autoload

Open phpooya opened this issue 3 years ago • 3 comments

php 7.4 "sentry/sdk": "2.0.3"

there is a problem on Sentry\init() initializing if you require multiple composer autoload with different packages. (note: sentry is present in one of them) because of using Composer\InstalledVersions in Jean85\PrettyVersions, in some cases the other composer class will load and there is no sentry in it.

OutOfBoundsException: Package "sentry/sentry" is not installed in /var/www/html/vendor2/composer/InstalledVersions.php:201
Stack trace:
#0 /var/www/html/vendor/jean85/pretty-package-versions/src/PrettyVersions.php(25): Composer\InstalledVersions::getPrettyVersion()
#1 /var/www/html/vendor/sentry/sentry/src/ClientBuilder.php(107): Jean85\PrettyVersions::getVersion()
#2 /var/www/html/vendor/sentry/sentry/src/ClientBuilder.php(115): Sentry\ClientBuilder->__construct()
#3 /var/www/html/vendor/sentry/sentry/src/functions.php(14): Sentry\ClientBuilder::create()
#4 /var/www/html/App.php(24): Sentry\init()
#5 {main}

thanks

phpooya avatar Aug 02 '22 14:08 phpooya

@Jean85 do you have any clue on how to solve this? :)

stayallive avatar Aug 02 '22 14:08 stayallive

Yes. I'll take a try to solve it

phpooya avatar Aug 05 '22 15:08 phpooya

IMHO it should be solved on the project side: autoloaders are nestable, so you should have a single one that's able to reach every piece of code\class.

Jean85 avatar Aug 09 '22 11:08 Jean85

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Backlog or Status: In Progress, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

github-actions[bot] avatar Sep 08 '22 00:09 github-actions[bot]