Skip to content
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

Potential fatal error when autoloading non-existent Composer class #6887

Closed
aaemnnosttv opened this issue Apr 14, 2023 · 2 comments
Closed
Labels
Exp: SP P0 High priority Type: Bug Something isn't working Type: Support Support request

Comments

@aaemnnosttv
Copy link
Collaborator

aaemnnosttv commented Apr 14, 2023

Bug Description

There have been a few reports of fatal errors since the last release 1.98.0

PHP Warning:  require_once(/var/www/html/web/wp-content/plugins/google-site-kit/third-party/vendor/composer/InstalledVersions.php): Failed to open stream: No such file or directory in /var/www/html/web/wp-content/plugins/google-site-kit/includes/loader.php on line 34
PHP Fatal error:  Uncaught Error: Failed opening required '/var/www/html/web/wp-content/plugins/google-site-kit/third-party/vendor/composer/InstalledVersions.php' (include_path='.:/usr/share/php') in /var/www/html/web/wp-content/plugins/google-site-kit/includes/loader.php:34

This dates back to a change made in #3830 which was later undone in #1146.

The initial guard which prevented this from happening used the required class name to only load Site Kit classes by checking the full class name. This had to be removed in #1146 when certain vendor-provided polyfill classes also needed to be autoloaded. Ultimately, the problem is that a non-existent class is attempted to be required.


Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

  • The Site Kit autoloader should not throw any errors due to non-existent files or classes

Implementation Brief

Test Coverage

  • No changes

QA Brief

  • Add the following snippet to a plugin or theme to reproduce the error on 1.98.0
add_action( 'plugins_loaded', array( '\Composer\InstalledVersions', 'getInstalledPackages' ) );
  • Once merged, the error should no longer happen on develop

Changelog entry

  • Fix a potential error when attempting to autoload a class from a non-existent file.
@aaemnnosttv aaemnnosttv added Type: Bug Something isn't working P0 High priority labels Apr 14, 2023
@aaemnnosttv aaemnnosttv self-assigned this Apr 14, 2023
@jamesozzie jamesozzie added the Type: Support Support request label Apr 17, 2023
@eugene-manuilov
Copy link
Collaborator

IB ✔️

@eugene-manuilov eugene-manuilov removed their assignment Apr 18, 2023
@wpdarren wpdarren self-assigned this Apr 19, 2023
@wpdarren
Copy link
Collaborator

QA Update: ✅

Verified

On 1.98.0 the PHP error message appeared in my logs.

image

I switched to the main branch and navigated around Site Kit and left it for 10 minutes and no further errors appeared.

@wpdarren wpdarren removed their assignment Apr 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Exp: SP P0 High priority Type: Bug Something isn't working Type: Support Support request
Projects
None yet
Development

No branches or pull requests

4 participants