Comments (2)
stream_select
modifies the array passed as an argument.
See https://www.php.net/manual/en/function.stream-select which says:
Note:
When stream_select() returns, the arrays read, write and except are modified to indicate which stream resource(s) actually changed status. The original keys of the arrays are preserved.
You can observe this by adding a var_dump inside your while loop.
The first iteration works, but the second one has cleared out the arrays, so the second call to stream_select
fails because the arrays are empty.
If you change the last while loop to this, it seems to work:
while(!stream_select($read, $read, $read, 0)) {
var_dump($read, count($read));
$read = [$server];
usleep(1000);
}
So as far as I can tell, this issue is about a misunderstanding of how stream_select
works. Does this help you, or am I missing something?
from php-src.
Oh my god, I've been so blind... Yes, you're absolutely right! I should've checked the docs more precisely... So it was a simple race condtion all the time. Sorry for this unnecessary ticket.
from php-src.
Related Issues (20)
- Consider removing autogenerated files from tarballs HOT 1
- hex2bin() returning a base64 encoded string HOT 9
- Member access within null pointer of type 'ps_files' in ext/session/mod_files.c HOT 1
- Unexpected Results with PHP8 date_diff for Different Timezones HOT 3
- Incorrect PHP_STREAM_OPTION_CHECK_LIVENESS case in ext/openssl/xp_ssl.c - causing use of dead socket HOT 1
- PECL list-upgrade doesn't seems to respect php versions HOT 4
- Removal during NodeList iteration breaks loop HOT 2
- Improve deprecation message for implicit nullable parameters HOT 3
- number_format() changed undocumented behaviour since PHP 8.3.0 HOT 5
- do_operation ZEND_BOOL_NOT not invoked HOT 1
- `preg_match` require match HOT 1
- auto_prepend_file register_shutdown_function TypeError fatal error because function not hoisted HOT 2
- [Chore] Officially support musl the same way glibc is supported HOT 11
- php.ini INI_SYSTEM: local value of "sys_temp_dir" does not overide master value and can bypass "open_basedir" (not a security issue FMPOV)
- Signed integer overflow in ext/date/lib/unixtime2tm.c
- ARM64 + BSD15 - CGI PHP - 502 Bad Gateway error HOT 5
- FR: allow use class constant interpolation in strings HOT 1
- === Total 1 memory leaks detected === zend_mm_heap corrupted Segmentation fault HOT 2
- [ feature/fix ] Internal functions needs exactly number of arguments needs to be optimized / And few more old bugs HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from php-src.