You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
AMP WP 2.0.6 breaks site due to PHP Fatal error: Uncaught OutOfBoundsException: Package "sentry/sentry" is not installed in [...]/wp-content/plugins/amp/vendor/composer/InstalledVersions.php:209
#5609
Closed
archon810 opened this issue
Nov 18, 2020
· 2 comments
· May be fixed by #5745
So it seems to be due to the plugin getting the Composer\InstalledVersions namespace first, and when the composer/package-versions-deprecated package calls Composer\InstalledVersions::getPrettyVersion() our bundled composer answers to that, which shouldn't happen.
Right now, I think we could only solve this reliably be getting rid from 'Composer\InstalledVersions' in our own autoloader. However, this is added in a hard-coded way directly within the generation of the autoloader.
Can we strip the 'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php', line from the autoloader during the plugin build step. This ensures that if multiple autoloaders are active, we don't rely on our autoloaders having this class and thus don't cause a conflict. However, one of our own dependencies might require it...?
Our autoloader should only be required if it is actually present within the folder. This allows a WordPress site built via a Composer stack to pull the plugin in via Composer and have a centralized autoloader. This is also what the site with the current issue should then do. Note that right now, we require the autoloader unconditionally, which will break on a site-wide Composer installation.
Also, the site that is currently breaking could use reload() immediately after requiring their own autoloader. I think that might solve the problem as well.
Bug Description
Expected Behaviour
AMP works.
Steps to reproduce
Additional context
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
Implementation brief
QA testing instructions
Demo
Changelog entry
The text was updated successfully, but these errors were encountered: