[wp-trac] [WordPress Trac] #48689: PHP warnings after updating to WP 5.3: ftp_nlist() and ftp_pwd() expect missing parameters

WordPress Trac noreply at wordpress.org
Thu Jun 6 16:28:18 UTC 2024


#48689: PHP warnings after updating to WP 5.3: ftp_nlist() and ftp_pwd() expect
missing parameters
-------------------------------------------------+-------------------------
 Reporter:  Hinjiriyo                            |       Owner:  costdev
     Type:  defect (bug)                         |      Status:  assigned
 Priority:  normal                               |   Milestone:  6.6
Component:  Filesystem API                       |     Version:  5.3
 Severity:  minor                                |  Resolution:
 Keywords:  php80 needs-unit-tests has-patch     |     Focuses:  php-
  2nd-opinion changes-requested dev-feedback     |  compatibility
-------------------------------------------------+-------------------------
Changes (by oglekler):

 * keywords:  php80 needs-unit-tests has-patch needs-testing 2nd-opinion =>
     php80 needs-unit-tests has-patch 2nd-opinion changes-requested dev-
     feedback


Comment:

 WP_Filesystem_SSH2 has

 {{{
                 if ( ! $this->link ) {
                         return false;
                 }
 }}}
 in one place. Possibly way forward is to add function that generate error
 and bail like this:
 {{{
                 if ( ! $this->link ) {
                         $this->error_missing_link( 'SSH2' );
                         return false;
                 }

 ....
         private function error_missing_link( $connection_name ) {
                 $this->errors->add(
                         'connection_name',
                         sprintf(
                                 /* translators: %s: Connection type. */
                                 __( 'Missing connection: %s' ),
                                 $connection_name
                         )
                 );
         }
 }}}

 This can be done for WP_Filesystem and for WP_Filesystem_SSH2 classes.

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


More information about the wp-trac mailing list