php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #58890 cast connection to select'able stream
Submitted: 2009-10-12 08:20 UTC Modified: -
Votes:2
Avg. Score:3.5 ± 0.5
Reproduced:0 of 0 (0.0%)
From: juzna dot cz at gmail dot com Assigned:
Status: Open Package: ssh2 (PECL)
PHP Version: 5.3.0RC4 OS: Ubuntu 64bit
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2009-10-12 08:20 UTC] juzna dot cz at gmail dot com
Description:
------------
In standard implementation, the resource returned from ssh2_connect() is not possible to pass to stream_select() function, which makes it impossible to implement some kind of applications.

In my app, I need to open several streams and select() them for data to read. When new data available, I'll read them and process them.

I've programmed function ssh2_get_stream() which gets selectable stream from connection resource. It is available on http://www.helemik.cz/juzna/opensource/php/ssh2/get_stream.diff

But it makes PHP seg fault when PHP finishes and frees memmory. I dont know how to solve it, maybe someone who understand it better could do it.

Thanks for any reply


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-12-04 09:46 UTC] samuel dot roze at gmail dot com
That is a functional patch:
http://www.d-sites.com/wp-content/uploads/2009/12/get_stream2.patch

When defining a stream ops, you MUST define the read, write, close and flush methods. Actually, in this way you can just define the close method.

Note: Is isn't working very well (the expected results are not mine, and you?) and, in my mind, it is a bad idea to select() on the result of ssh2_connect but it must be more interesting on an SSH2 Stream, returned by the ssh2_shell function. I'm working on that.

Samuel.
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Mon Jul 06 10:01:29 2020 UTC