Make WordPress Core

Opened 5 years ago

Last modified 5 years ago

#55469 new enhancement

WP_Filesystem_SSH2::chmod() should use ssh2_sftp_chmod()

Reported by: pbiron Owned by:
Priority: normal Milestone: Awaiting Review
Component: Filesystem API Version:
Severity: normal Keywords: has-patch needs-testing
Cc: Focuses:

Description

WP_Filesystem_SSH2::chmod() currently uses ::run_command( sprintf( 'chmod %o %s', $mode, escapeshellarg( $file ) ), true ) (which calls ​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 ​0.12, the ssh2 extension introduced ​ssh2_sftp_chmod(), and WP_Filesystem_SSH2::chmod() should be changed to use it.

Change History (2)

This ticket was mentioned in ​PR #2464 on ​WordPress/wordpress-develop by ​pbiron.


5 years ago
#1

  • Keywords has-patch added

Trac ticket: #55469

#2 @pbiron
5 years ago

  • Keywords needs-testing added
Note: See TracTickets for help on using tickets.