Make WordPress Core

Opened 2 years ago

Last modified 2 years ago

#55469 new enhancement

WP_Filesystem_SSH2::chmod() should use ssh2_sftp_chmod()

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

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.


2 years ago
#1

  • Keywords has-patch added

Trac ticket: #55469

#2 @pbiron
2 years ago

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