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

File not found error during plugin upgrades #6304

Closed
malithsen opened this issue May 15, 2023 · 2 comments · Fixed by #8439
Closed

File not found error during plugin upgrades #6304

malithsen opened this issue May 15, 2023 · 2 comments · Fixed by #8439
Assignees
Labels
category: core WC Payments core related issues, where it’s obvious. focus: woopay type: bug The issue is a confirmed bug.

Comments

@malithsen
Copy link
Member

malithsen commented May 15, 2023

Describe the bug

When a file included in init_rest_api is removed, it results in a missing file error during the plugin upgrade process.
This happens because init_rest_api of the the old version is invoked during the upgrade but the file it's trying to load is removed in the new version.

To Reproduce

  1. Install WCPay 5.8.1.
  2. Go through onboarding.
  3. Remove class-wc-rest-user-exists-controller.php
  4. Build the plugin locally
  5. Upgrade the site to the plugin built in step 4
  6. Expect the fatal error below.
Failed opening '/srv/users/user217f0884/apps/user217f0884/public/wp-content/plugins/woocommerce-payments/includes/admin/class-wc-rest-user-exists-controller.php' for inclusion (include_path='.:/opt/sp/php7.4/lib/php') in /srv/users/user217f0884/apps/user217f0884/public/wp-content/plugins/woocommerce-payments/includes/class-wc-payments.php on line 954

Fatal error: Uncaught Error: Class 'WC_REST_User_Exists_Controller' not found in /srv/users/user217f0884/apps/user217f0884/public/wp-content/plugins/woocommerce-payments/includes/class-wc-payments.php:955 Stack trace: #0 /srv/users/user217f0884/apps/user217f0884/public/wp-includes/class-wp-hook.php(308): WC_Payments::init_rest_api(Object(WP_REST_Server)) #1 /srv/users/user217f0884/apps/user217f0884/public/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters(NULL, Array) #2 /srv/users/user217f0884/apps/user217f0884/public/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #3 /srv/users/user217f0884/apps/user217f0884/public/wp-includes/rest-api.php(577): do_action('rest_api_init', Object(WP_REST_Server)) #4 /srv/users/user217f0884/apps/user217f0884/public/wp-includes/rest-api.php(535): rest_get_server() #5 /srv/users/user217f0884/apps/user217f0884/public/wp-includes/rest-api.php(2889): rest_do_request(Object(WP_REST_Request)) #6 [internal function]: rest_preload_api_request(Array, '/wc-analytics/r...') #7 /srv/use in /srv/users/user217f0884/apps/user217f0884/public/wp-content/plugins/woocommerce-payments/includes/class-wc-payments.php on line 955

Actual behavior

Error shown when upgrading the plugin

Screenshots

Expected behavior

No errors should be printed

Additional context

Slack thread: p1684148049557989-slack-CGGCLBN58

Related: #6303

@malithsen malithsen added type: bug The issue is a confirmed bug. category: core WC Payments core related issues, where it’s obvious. labels May 15, 2023
@alefesouza alefesouza self-assigned this May 15, 2023
@zmaglica
Copy link
Contributor

@alefesouza I noticed that this issue is assigned to you. Are you still planning to work on this issue?

@htdat
Copy link
Member

htdat commented Feb 26, 2024

It seems that the cause is described here paJDYF-aZa-p2#comment-21382

@haszari haszari added the focus: misc or unknown Issues that need to be added to a focus area (aka "needs focus"). label Mar 11, 2024
@vbelolapotkov vbelolapotkov added focus: woopay and removed focus: misc or unknown Issues that need to be added to a focus area (aka "needs focus"). labels Mar 13, 2024
@alefesouza alefesouza mentioned this issue Mar 22, 2024
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: core WC Payments core related issues, where it’s obvious. focus: woopay type: bug The issue is a confirmed bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants