[wp-trac] [WordPress Trac] #55469: WP_Filesystem_SSH2::chmod() should use ssh2_sftp_chmod()

WordPress Trac noreply at wordpress.org
Sun Mar 27 17:10:57 UTC 2022


#55469: WP_Filesystem_SSH2::chmod() should use ssh2_sftp_chmod()
----------------------------+-----------------------------
 Reporter:  pbiron          |      Owner:  (none)
     Type:  enhancement     |     Status:  new
 Priority:  normal          |  Milestone:  Awaiting Review
Component:  Filesystem API  |    Version:
 Severity:  normal          |   Keywords:
  Focuses:                  |
----------------------------+-----------------------------
 `WP_Filesystem_SSH2::chmod()` currently uses `::run_command( sprintf(
 'chmod %o %s', $mode, escapeshellarg( $file ) ), true )` (which calls
 [https://www.php.net/manual/en/function.ssh2-exec.php ssh2_exec()]).  It
 has essentially been this way since `WP_Filesystem_SS2` was introduced in
 [8812].

 However, some sftp servers do not allow `ssh2_exec()` to be run,
 generating PHP warnings such as:

 > PHP Warning:  ssh2_exec(): Unable to request command execution on remote
 host

 and on those severs all calls to `WP_Filesystem_SSH2::chmod()` basically
 become noops.

 Luckily, starting with version [https://pecl.php.net/package/ssh2/0.12
 0.12], the ssh2 extension introduced
 [https://www.php.net/manual/en/function.ssh2-sftp-chmod.php
 ssh2_sftp_chmod()], and `WP_Filesystem_SSH2::chmod()` should be changed to
 use it.

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


More information about the wp-trac mailing list