From 4e4a8249087de62d98942882d5da9d198bc67d63 Mon Sep 17 00:00:00 2001 From: Ian Date: Thu, 12 Jan 2017 09:04:58 +1300 Subject: [PATCH] Fix SFTP getUrl function for PHP >= 5.6.28 PHP 5.6.28 made an (apparently undocumented) change for scanning an SFTP directory. Previously the URL was created by casting the Resource as a string ("Resource #27"), now it requires it to be cast as an int ("27"). Previously this function returned ssh2.sftp://Resource #27/my/url, now returns ssh2.sftp://27/my/url. The "new" method has been tested in 5.6.26 and still works correctly (as well as 5.6.29 and 7.0.14). --- src/Ssh/Sftp.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Ssh/Sftp.php b/src/Ssh/Sftp.php index e19767c..198502a 100644 --- a/src/Ssh/Sftp.php +++ b/src/Ssh/Sftp.php @@ -202,7 +202,7 @@ public function send($local, $distant) */ public function getUrl($filename) { - return sprintf('ssh2.sftp://%s/%s', $this->getResource(), $filename); + return sprintf('ssh2.sftp://%d/%s', $this->getResource(), $filename); } /**