query-monitor icon indicating copy to clipboard operation
query-monitor copied to clipboard

Problem w/ the auto-loader in 3.16.0

Open pbiron opened this issue 10 months ago • 11 comments

I just updated to the newly released v3.16.0 and the site crashed w/ a WSOD. Appears there's a problem in the composer auto-loader in the new version

Warning: require(path-to-site/plugins/query-monitor/vendor/composer/../symfony/deprecation-contracts/function.php): Failed to open stream: No such file or directory in path-to-site/plugins/query-monitor/vendor/composer/autoload_real.php on line 42

Fatal error: Uncaught Error: Failed opening required 'path-to-site/plugins/query-monitor/vendor/composer/../symfony/deprecation-contracts/function.php' (include_path='.;C:\php\pear') in path-to-site/plugins/query-monitor/vendor/composer/autoload_real.php:42 Stack trace: #0 path-to-/site/plugins/query-monitor/vendor/composer/autoload_real.php(46): {closure}('6e3fae29631ef28...', 'path-to-site...') #1 path-to-site/plugins/query-monitor/vendor/autoload.php(25): ComposerAutoloaderInitad25d53a23099da4b0886b4f6754360e::getLoader() #2 path-to-site/plugins/query-monitor/wp-content/db.php(78): require_once('path-to-site...') #3 path-to-site/wp-includes/load.php(675): require_once('path-to-site...') #4 path-to-site/wp-settings.php(131): require_wp_db() #5 path-to-site/wp-config.php(105): require_once('path-to-site...') #6 path-to-site/wp-load.php(50): require_once('path-to-site...') #7 path-to-site/wp-admin/admin.php(34): require_once('path-to-site...') #8 path-to-site/wp-admin/plugins.php(10): require_once('path-to-site...') #9 {main} thrown in path-to-site/plugins/query-monitor/vendor/composer/autoload_real.php on line 42

pbiron avatar Apr 22 '24 14:04 pbiron

This Composer configuration has been nothing but a nightmare. I need to find a way to make it determinate and testable.

johnbillion avatar Apr 22 '24 14:04 johnbillion

I've shipped a fix for this directly to wordpress.org as 3.16.1 because evidently there is an issue with the Composer configuration in the build action here on GitHub.

johnbillion avatar Apr 22 '24 14:04 johnbillion

Sorry but I get the same problem but for another file myclabs/deep-copy/src/DeepCopy/deep_copy.php

Warning: require(/app/web/app/plugins/query-monitor/vendor/composer/../myclabs/deep-copy/src/DeepCopy/deep_copy.php): Failed to open stream: No such file or directory in /app/web/app/plugins/query-monitor/vendor/composer/autoload_real.php on line 42

Fatal error: Uncaught Error: Failed opening required '/app/web/app/plugins/query-monitor/vendor/composer/../myclabs/deep-copy/src/DeepCopy/deep_copy.php' (include_path='.:/usr/share/php') in /app/web/app/plugins/query-monitor/vendor/composer/autoload_real.php:42 Stack trace: #0 /app/web/app/plugins/query-monitor/vendor/composer/autoload_real.php(46): {closure}() #1 /app/web/app/plugins/query-monitor/vendor/autoload.php(25): ComposerAutoloaderInitad25d53a23099da4b0886b4f6754360e::getLoader() #2 /app/web/app/plugins/query-monitor/query-monitor.php(56): require_once('...') #3 /app/web/wp/wp-settings.php(517): include_once('...') #4 /app/web/wp-config.php(10): require_once('...') #5 /app/web/wp/wp-load.php(55): require_once('...') #6 /app/web/wp/wp-blog-header.php(13): require_once('...') #7 /app/web/index.php(5): require('...') #8 {main} thrown in /app/web/app/plugins/query-monitor/vendor/composer/autoload_real.php on line 42

edit

3.16.1 was not available on wpackagist when I tested. Same problem as @pbiron now.

Thanks for looking into it so quickly @johnbillion :)

edit 2

Downgrade to 3.15 works

slackday avatar Apr 22 '24 14:04 slackday

unfortunately, 3.16.1 fatals as well, with a slightly different error message

Fatal error: Uncaught Error: Class "QM_Activation" not found in path-to-site/plugins/query-monitor/query-monitor.php:58

pbiron avatar Apr 22 '24 14:04 pbiron

I think I need to get rid of the dependency on the Composer autoloader and ship my own. It's just a simple class mapping, so the rest of the Composer autoloading functionality isn't needed.

johnbillion avatar Apr 22 '24 14:04 johnbillion

I just cloned the repo to my local machine and did a composer dump-autoload from the command-line. And that seems to produce a usable auto-loader. The vendor dir resulting from that CLI (which has the working auto-loader) is attached here.

vendor.zip

pbiron avatar Apr 22 '24 14:04 pbiron

Shipped 3.16.2 with that class map back in place. Bleugh.

johnbillion avatar Apr 22 '24 14:04 johnbillion

success: 3.16.2 works!

Thanx for jumping on this so quickly!

pbiron avatar Apr 22 '24 15:04 pbiron

Not sure if it's worth making a new issue, but

  • I have an autoloader-related problem
  • in version 3.16.2

I am able to install/activate the plugin (via wp-cli) with no problem, but the site then throws a critical error:

PHP Fatal error:  Cannot declare class ComposerAutoloaderInitad25d53a23099da4b0886b4f6754360e, because
 the name is already in use in /var/www/html/example.com/wp-content/plugins/query-monitor/vendor/com
poser/autoload_real.php on line 5

I'm happy to split this out into a separate issue if that's better.

jakeparis avatar May 09 '24 15:05 jakeparis

@jakeparis Yeah that's a separate issue, probably not related to this one. Can you try deleting the wp-content/db.php file? Then deactivate and reactivate QM.

More info here: https://wordpress.org/support/topic/fatal-error-cannot-declare-class-composerautoloader/

johnbillion avatar May 09 '24 15:05 johnbillion

Yes, fixed it. Thank you for that reference.

jakeparis avatar May 09 '24 16:05 jakeparis