php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #63480 Warning on using the SSH2 Session resource in the uri
Submitted: 2012-11-10 13:24 UTC Modified: 2021-02-09 15:21 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: langemeijer@php.net Assigned: cmb (profile)
Status: Closed Package: ssh2 (PECL)
PHP Version: Irrelevant OS: any
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
26 + 37 = ?
Subscribe to this entry?

 
 [2012-11-10 13:24 UTC] langemeijer@php.net
Description:
------------
Using the resource inline in the uri works, (ie, 
ssh2.sftp://$session/path/to/file) but will throw a "supplied resource is not a 
valid SSH2 SFTP resource in .." warning on things like file_get_contents.


--
I found this bugreport in a note in the manual, original by stm555 at hotmail dot 
com

Test script:
---------------
$session = ssh2_connect('shell.example.com', 22);
ssh2_auth_agent($session, 'username');

$passwd = file_get_contents("ssh2.sftp://$session/etc/passwd");


Expected result:
----------------
There should be no warning when everything is peachy

Actual result:
--------------
Warning: file_get_contents(): supplied resource is not a valid SSH2 SFTP resource 
in /home/casper/projects/aaa/ssh2.php

Patches

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-02-09 15:21 UTC] cmb@php.net
-Summary: Warning on using the resource inline in the uri. +Summary: Warning on using the SSH2 Session resource in the uri -Status: Open +Status: Verified -Assigned To: +Assigned To: cmb
 [2021-02-09 15:21 UTC] cmb@php.net
Indeed, using an SSH2 Session resource is also supported (in
addition to SSH2 SFTP resources), so there shouldn't be a warning,
especially since using SSH2 Session resources is documented[1].

[1] <https://www.php.net/manual/en/wrappers.ssh2.php>
 [2021-02-09 15:35 UTC] cmb@php.net
The following pull request has been associated:

Patch Name: Fix #63480: Warning on using the SSH2 Session resource in the uri
On GitHub:  https://github.com/php/pecl-networking-ssh2/pull/47
Patch:      https://github.com/php/pecl-networking-ssh2/pull/47.patch
 [2021-02-24 21:09 UTC] langemeijer@php.net
Automatic comment on behalf of casper.langemeijer@procurios.nl
Revision: http://git.php.net/?p=pecl/networking/ssh2.git;a=commit;h=1432b041e7cb605f6dc674172e408c4477437aa8
Log: Merge pull request #47: Fix #63480: Warning on using the SSH2 Session resource in the uri
 [2021-02-24 21:09 UTC] langemeijer@php.net
-Status: Verified +Status: Closed
 [2021-02-24 21:09 UTC] langemeijer@php.net
Automatic comment on behalf of cmbecker69@gmx.de
Revision: http://git.php.net/?p=pecl/networking/ssh2.git;a=commit;h=99c8c49eb4616a5c7b747504fa572732f2916d10
Log: Fix #63480: Warning on using the SSH2 Session resource in the uri
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue May 11 11:01:23 2021 UTC