|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #34380 need stream equivalent to socket_last_error
Submitted: 2005-09-05 22:42 UTC Modified: 2023-05-08 16:59 UTC
Avg. Score:4.2 ± 0.8
Reproduced:10 of 10 (100.0%)
Same Version:2 (20.0%)
Same OS:3 (30.0%)
From: jim at centerfuse dot net Assigned:
Status: Open Package: Streams related
PHP Version: 5.0.4 OS: FreeBSD
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: jim at centerfuse dot net
New email:
PHP Version: OS:


 [2005-09-05 22:42 UTC] jim at centerfuse dot net
In order to determine if a function such as stream_select() returning false was a significant error, or just an "interrupted system call" (which can happen due to other signals interrupting the select), it'd be quite useful to have a stream_last_error() function that allows us to check the error code returned by stream_select(). 


Add a Patch

Pull Requests

Pull requests:

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-12-01 06:04 UTC] jim at centerfuse dot net
Just wondering if there's any word on this. I'm having trouble with the sockets module crashing my PHP daemon (bug report will come when I figure out what's going on, and after I make sure it's not my fault), and I'd like to move to streams. However, the lack of stream_last_error() is making this a bit difficult.
 [2009-05-19 09:42 UTC] andreas at softwaredesign dot se
This bug really needs some attention. It seems that as of today, there is no way to tell whether a stream had a real error, or it just got interrupted by a signal.

This makes writing PHP daemons managing child processes using proc_open and stream_select virtually impossible when the daemon also needs to be able to intercept signals (as a daemon preferably would). The stream_select *will* get interrupted by signals, and as the bug report states, there is no way to tell if the interruption was because of a signal, or if something really scary happened. 

This leads us to the one and only horrible solution: ignoring all errors that stream_select returns, as we presume that the system call was just interrupted.
 [2009-08-04 20:48 UTC] jerrywilborn at gmail dot com
Just coming along to bump this as well. It would be quite helpful to be 
able to get the status of a ASYNC stream_socket_client connection 
without doing a fwrite/fgets-type work around.
 [2012-06-06 13:10 UTC] fxbois at gmail dot com
Is there any chance that this request (/bug ?) will be solved. I confirm that it is impossible to write a daemon mixing socker/stream and signals.
 [2014-09-23 20:45 UTC] ezacks at barracuda dot com
Potential solution here for stream_select and stream_socketpair:

This change preserves errno in posix_globals, allowing posix_get_last_error() to reflect the failure reason.
 [2016-12-30 23:08 UTC]
-Package: Feature/Change Request +Package: Streams related
 [2023-05-03 11:39 UTC] deepkbtayyab at gmail dot com
Travel Insider Blog are sharing latest news portal about travel, destination, beaches, tourist places, travel spot, travel insider etc. More info to visit: (
 [2023-05-08 16:59 UTC]
Related to
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Jul 15 08:01:28 2024 UTC