Yoast / wordpress-seo

Yoast SEO for WordPress
https://yoast.com/wordpress/plugins/seo/
Other
1.77k stars 893 forks source link

Fatal error when updating from 21.8.1 to 21.9 #21077

Closed skinymikeofdoom closed 9 months ago

skinymikeofdoom commented 9 months ago

Please give us a description of what happened

when updating wordpress-seo from version 21.8.1 to 21.9 a fatal error occurs: Fatal error: Uncaught Error: ftp_nlist(): Argument #1 ($ftp) must be of type FTP\Connection, null given

To Reproduce

Step-by-step reproduction instructions

  1. Install wordpress-seo version 21.8.1 and activate the plugin
  2. Update to 21.9 (using wp-cli or replace the plugin files manually)
  3. refresh page

Expected results

  1. Website should work

Actual results

  1. Fatal error: Uncaught Error: ftp_nlist(): Argument #1 ($ftp) must be of type FTP\Connection, null given

Screenshots, screen recording, code snippet

If possible, please provide a screenshot, a screen recording or a code snippet which demonstrates the bug.

wordpress-seo-fatal-error

I think it is related to this section: https://github.com/Yoast/wordpress-seo/blob/13b47960d3b8371f9d380d6e44b750a3c8b48f31/wp-seo-main.php#L361

deactivating and then reactivating the plugin (using wp-cli) resolves the fatal error, it seem to be related to invalidating the cache.

Technical info

Used versions

enricobattocchi commented 9 months ago

Hi @skinymikeofdoom, thanks for the report!

We'll investigate to find what happens.

lunaluna commented 9 months ago

@skinymikeofdoom @enricobattocchi

I had the exact same phenomenon. When I upgraded te Yoast SEO plugin from 21.8.1 to 21.9, I got a Fatal Error and the error was the same. The solution was also the same: deactivate the plugin using wp-cli and re-activate it using the same method.

Server architecture: Linux 4.14.165-131.185.amzn2.x86_64 x86_64 Web server: Apache/2.4.54 () OpenSSL/1.0.2k-fips PHP/8.0.25 PHP version: 8.0.25 (Supports 64bit values) PHP SAPI: apache2handler

enricobattocchi commented 9 months ago

@skinymikeofdoom @lunaluna We are try to reproduce it, can you tell us whether your setup requires you (or required just the first time) to insert your FTP credentials into WP to perform an update or a plugin installation via the GUI, as opposed to the "normal" case where it doesn't happen? Or is there any other relevant thing to know about your filesystem?

skinymikeofdoom commented 9 months ago

@enricobattocchi no ftp credentials are ever used in my configuration. I update the plugins using wp-cli for the most part - but I did test by replacing the files in situ and encountered the same problem.

It is also worth mentioning that I have reproduced this issue on 3 different server configurations (Docker, Rackspace and Azure)

izzygld commented 9 months ago

Getting same error/issue too.

Fatal error: Uncaught TypeError: ftp_nlist(): Argument #1 ($ftp) must be of type FTP\Connection, null given in /share/public/wp/wp-admin/includes/class-wp-filesystem-ftpext.php:438 Stack trace: #0 /share/public/wp/wp-admin/includes/class-wp-filesystem-ftpext.php(438): ftp_nlist() #1 /share/public/wp/wp-admin/includes/class-wp-filesystem-ftpext.php(456): WP_Filesystem_FTPext->exists() #2 /share/public/wp/wp-admin/includes/class-wp-filesystem-ftpext.php(757): WP_Filesystem_FTPext->is_file() #3 /share/public/wp/wp-admin/includes/file.php(2772): WP_Filesystem_FTPext->dirlist() #4 /share/public/content/plugins/wordpress-seo/wp-seo-main.php(361): wp_opcache_invalidate_directory() #5 /share/public/wp/wp-includes/class-wp-hook.php(324): wpseo_init() #6 /share/public/wp/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters() #7 /share/public/wp/wp-includes/plugin.php(517): WP_Hook->do_action() #8 /share/public/wp/wp-settings.php(506): do_action() #9 /share/public/wp-config.php(362): require_once('/share/public/w...') #10 /share/public/wp/wp-load.php(55): require_once('/share/public/w...') #11 /share/public/wp/wp-admin/admin.php(34): require_once('/share/public/w...') #12 /share/public/wp/wp-admin/index.php(10): require_once('/share/public/w...') #13 {main} thrown in /share/public/wp/wp-admin/includes/class-wp-filesystem-ftpext.php on line 438

Screenshot 2024-01-24 at 13 57 22
enricobattocchi commented 9 months ago

Hi everyone, thanks for the info. We are going to release a new version today that (among other stuff) should fix this issue by reverting the change that introduced the problem. We will look into improving our solution making sure that it doesn't cause similar problems.

enricobattocchi commented 9 months ago

The release is out, fixing the issue. Thanks everyone of your info and for your patience.