[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
Fri Dec 20 04:15:35 UTC 2024


#62718: Automatic updater of WordPress always fails if FS_METHOD is ftpext since
6.6 with PHP 8.0+
--------------------------+-----------------------------
 Reporter:  hideishi      |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  6.6
 Severity:  major         |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 Since WordPress 6.6, enabling maintenance mode is introduced in automatic
 update.
 The source code is wp-admin/includes/class-wp-automatic-updater.php in
 public function update().

 {{{#!php
 <?php
 if ( 'translation' !== $type ) {
         $upgrader->maintenance_mode( true );
 }
 }}}

 The main problem is that in the called maintenance_mode(), WP_Filesystem()
 is called without any arguments.
 When FS_METHOD is set to 'ftpext' (or non 'direct'), credentials are
 necessary to pass to WP_Filesystem() constructor.
 Because no argument is passed, returned WP_Filesystem() has an empty
 $link.
 Since PHP 8.0, ftp_nlist() does not accept null as first argument that
 results in PHP Fatal Error.


 {{{
 NOTICE: PHP message: PHP Fatal error:  Uncaught TypeError: ftp_nlist():
 Argument #1 ($ftp) must be of type FTP\Connection, null given in
 /home/kusanagi/kusanagi9/DocumentRoot/wp-admin/includes/class-wp-
 filesystem-ftpext.php:438
 Stack trace:
 #0 /home/kusanagi/kusanagi9/DocumentRoot/wp-admin/includes/class-wp-
 filesystem-ftpext.php(438): ftp_nlist()
 #1 /home/kusanagi/kusanagi9/DocumentRoot/wp-admin/includes/class-wp-
 filesystem-base.php(231): WP_Filesystem_FTPext->exists()
 #2 /home/kusanagi/kusanagi9/DocumentRoot/wp-admin/includes/class-wp-
 filesystem-base.php(58): WP_Filesystem_Base->find_folder()
 #3 /home/kusanagi/kusanagi9/DocumentRoot/wp-admin/includes/class-wp-
 upgrader.php(997): WP_Filesystem_Base->abspath()
 #4 /home/kusanagi/kusanagi9/DocumentRoot/wp-admin/includes/class-wp-
 automatic-updater.php(474): WP_Upgrader->maintenance_mode()
 #5 /home/kusanagi/kusanagi9/DocumentRoot/wp-admin/includes/class-wp-
 automatic-updater.php(676): WP_Automatic_Updater->update()
 #6 /home/kusanagi/kusanagi9/DocumentRoot/wp-inc...
 }}}

 This causes the automatic updater to stop here, hence Automatic updater
 will never update WordPress core if the core is updated once to 6.6 or
 later (also updating plugins and themes fails!).
 Prior to 6.6, maintenance_mode() was not enabled. Therefore, automati
 updater did not fail at this point end was eble to proceed to the later
 process where WP_Filesystem() was generated with proper credentials.

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


More information about the wp-trac mailing list