Skip to content

Commit 4e4a824

Browse files
authored
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 Herzult#27"), now it requires it to be cast as an int ("27"). Previously this function returned ssh2.sftp://Resource Herzult#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).
1 parent c56875c commit 4e4a824

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Ssh/Sftp.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ public function send($local, $distant)
202202
*/
203203
public function getUrl($filename)
204204
{
205-
return sprintf('ssh2.sftp://%s/%s', $this->getResource(), $filename);
205+
return sprintf('ssh2.sftp://%d/%s', $this->getResource(), $filename);
206206
}
207207

208208
/**

0 commit comments

Comments
 (0)