[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
Mon Dec 19 20:28:05 UTC 2022


#48689: PHP warnings after updating to WP 5.3: ftp_nlist() and ftp_pwd() expect
missing parameters
-------------------------------------------------+-------------------------
 Reporter:  Hinjiriyo                            |       Owner:
                                                 |  adamsilverstein
     Type:  defect (bug)                         |      Status:  assigned
 Priority:  normal                               |   Milestone:  Future
                                                 |  Release
Component:  Filesystem API                       |     Version:  5.3
 Severity:  minor                                |  Resolution:
 Keywords:  php8 needs-unit-tests has-patch      |     Focuses:
  needs-testing 2nd-opinion                      |
-------------------------------------------------+-------------------------

Comment (by sc0ttkclark):

 The patch makes a lot of sense here but it doesn't cover ssh2 which also
 makes use of `$this->link` and would exhibit the same type of issue as it
 uses `$this->link` in functions that expect a resource.

 The `WP_Filesystem_ftpsockets` class is safe because uses `ftp_sockets` or
 `ftp_pure` classes (depending on sockets use) which already checks to see
 if the ftp resource is connected before calling the functions that would
 cause errors like this.

 To move forward:

 * Add checks in `WP_Filesystem_SSH2` that check `$this->link` before
 passing it to a function expecting a resource
 * Add tests for ftpext and ssh2 in cases where a connection could not be
 made, confirming the methods return as expected (with no errors)

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


More information about the wp-trac mailing list