简体   繁体   中英

stream_select bug in PHP — I can't change my php version, what alternatives or hacks can I do?

I am working on someone's server that only has PHP version 5.0.4. I am not permitted to update the PHP version at this time because they have some old programs, etc. that would need to be checked before the upgrade is made and they have not done so yet.

After numerous attempts to get my program which uses the stream_select() function to work, I just discovered that there is a bug in this function so that regardless of the status, it always returns the value of 0 to me.

You can see more details about the bug below:

https://bugs.php.net/bug.php?id=42682

So my question is this -- I am opening a socket and reading/writing to a stream. I need to know if the stream is available for reading. Are there any hacks I can use to get around this bug? I do not have that much experience with socket programming.

Thank you in advance.

Have you tried socket _select() ?

This will require you to use socket functions instead of stream ones, but socket_select may (or may not) be free from this bug.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM