[wp-trac] [WordPress Trac] #62718: Automatic updater of WordPress always fails if FS_METHOD is ftpext since 6.6 with PHP 8.0+

WordPress Trac noreply at wordpress.org
Wed Mar 26 11:31:35 UTC 2025


#62718: Automatic updater of WordPress always fails if FS_METHOD is ftpext since
6.6 with PHP 8.0+
-------------------------------------------------+-------------------------
 Reporter:  hideishi                             |       Owner:
                                                 |  SergeyBiryukov
     Type:  defect (bug)                         |      Status:  reopened
 Priority:  normal                               |   Milestone:  6.9
Component:  Upgrade/Install                      |     Version:  6.6
 Severity:  major                                |  Resolution:
 Keywords:  needs-unit-tests has-testing-info    |     Focuses:
  changes-requested reporter-feedback            |
-------------------------------------------------+-------------------------

Comment (by hideishi):

 @SirLouen

 > You said that the bug occur when no credentials are placed. Or I did
 understand it wrongly?

 Yes, you are misunderstanding the issue.

 The issue is that the WordPress function `WP_filesystem()` is called
 **without any crendentials as an argument to the function**. I really mean
 from PHP coding perspective, calling `WP_filesystem()` rather than calling
 `WP_filesystem( $crendentials )`.

 You need to supply the "default" credential (as I wrote in wp-config.php)
 somewhere anyway.

 The code submitted in comment:2 provides the workaround that internally
 parses wp-config.php or any other options to load defined credentials, and
 preloads to `$credential` so that it can be supplied to `WP_filesystem()`
 programatically without any manual interaction.

 If FS_METHOD is ftpext (or anything that requires actual credentials), you
 need the credential.
 If no credential is set in wp-config.php, accessing to the filesystem will
 fail because the WordPress can't access to the filesystem via FTP.
 Therefore, it is always necessay to set the credential in wp-config.php in
 order to work the automatic updates correctly.

 Let me clarify the procedures.

 1. Setup ftp environment (localhost is just fine)
 2. Install older WordPress for which updates are available, but 6.6 or
 later.
 3. Write the credentials to wp-config.php including FTP_USER and FTP_PASS
 as well as setting FS_METHOD to ftpext.
 4. Wait for automatic updates to happen.
 5. You will see the PHP Exception and automatic updates fails.

 If you setup WordPress prior to 6.6 (in which PHP code calling
 `WP_filesystem()` without any credential as an argument was not present),
 automatic updates will succeed.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/62718#comment:18>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list