WordPress.org

Make WordPress Core

Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#41030 closed defect (bug) (duplicate)

ssh2 FS_METHOD will not work with various php versions

Reported by: kynks Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Filesystem API Keywords:
Focuses: Cc:
PR Number:

Description

Due to this PHP bug - https://bugs.php.net/bug.php?id=73597

ssh2 as FS_METHOD will not work with various version of PHP.

Namely, WP_Filesystem_SSH2::is_dir() will always return false. The workaround suggested on the above PHP ticket should resolve the issue - using the intval() function in WP_Filesystem_SSH2::sftp_path() should resolve the issue, although I haven't tested this across a tonne of php versions.

eg:

<?php
public function sftp_path( $path ) {
                if ( '/' === $path ) {
                        $path = '/./';
                }
                return 'ssh2.sftp://' . intval($this->sftp_link) . '/' . ltrim( $path, '/' );
        }

Change History (2)

#1 @ocean90
2 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed
  • Version trunk deleted

Hello @kynks, welcome to WordPress Trac!

Thanks for your report, we're already tracking this issue in #35517.

#2 @kynks
2 years ago

Hi @ocean90

I'm not entirely convinced that that is the same issue, although it is definitely related. I should have mentioned in the report, but this issue occurs on PHP >=5.6.28,<7.*

The issue you linked certainly looks like a bug in the php7 ssh2 extension from the ubuntu repos - https://askubuntu.com/questions/786102/upgraded-ubuntu-to-16-04-now-wordpress-updates-dont-work - it seems the workaround for the issue that people are using is to install the pecl ssh2-1.0 extenstion instead (which is only compatible with PHP7.x).

Last edited 2 years ago by kynks (previous) (diff)
Note: See TracTickets for help on using tickets.