|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75523 stream_set_timeout(): No support for ssh2 stream timeout
Submitted: 2017-11-14 11:41 UTC Modified: -
From: marcos dot guerrero at isastur dot com Assigned:
Status: Open Package: ssh2 (PECL)
PHP Version: 7.1.11 OS: Windows 10
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2017-11-14 11:41 UTC] marcos dot guerrero at isastur dot com
PHP 7.1.11 nts x64
Pecl ssh2 7.1 1.1.2 nts x64 (although it happens with 1.0, 1.1, 1.1.1 as well)

When I try to set stream_set_timeout to the resource given by ssh2_exec it fails with:
 PHP Warning:  stream_set_timeout(): No support for ssh2 stream timeout. Please recompile with libssh2 >= 1.2.9

But the phpinfo shows 


SSH2 support => enabled
extension version => 1.1.2
libssh2 version => 1.7.0
banner => SSH-2.0-libssh2_1.7.0

So I think 1.7.0 is >= 1.2.9 
Why is it complaining about the version then 

Test script:
$session = ssh2_connect('localhost', 2222);
ssh2_auth_password($session, 'ubuntu', 'ubuntu');
$out = ssh2_exec($session, 'date ; sleep 10s; date');
stream_set_timeout($out, 5);
stream_set_blocking($out, true);
echo stream_get_contents($out);

Expected result:
The stream_get_contents should return after 5 seconds (and therefore I should get only one date in the output)

Actual result:
The stream_gets_contents returns after the end of script execution (10 s) and I get the two dates


Add a Patch

Pull Requests

Add a Pull Request

PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Fri May 29 05:01:25 2020 UTC