note 123582 added to function.stream-select
| From: | Sitsofe@php.net | Date: | Mon, 04 Feb 2019 06:52:33 +0000 |
| Subject: | note 123582 added to function.stream-select | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-210190@lists.php.net to get a copy of this message | ||
When stream_select() fails you SHOULD NOT use the results of the arrays (i.e. read, write, except)
that were passed into it as parameters. While doing so anyway won't trigger undefined
behaviour, you are depending on unspecified behaviour that by definition is not guaranteed.
At the time of writing the PHP 7.2 interpreter does not modify the arrays upon stream_select()
failure (see the code around https://github.com/php/php-src/blob/php-7.2.14/ext/standard/streamsfuncs.c#L842)
thus a PHP program that doesn't heed the advice above can deceive itself as to the state of
those streams.
(Hopefully this warning can be added to the main documentation one day)
----
Server IP: 208.43.231.9
Probable Submitter: 185.85.3.194 (proxied: 146.90.204.203)
----
Manual Page -- http://php.net/manual/en/function.stream-select.php
Edit -- https://master.php.net/note/edit/123582
Del: integrated -- https://master.php.net/note/delete/123582/integrated
Del: useless -- https://master.php.net/note/delete/123582/useless
Del: bad code -- https://master.php.net/note/delete/123582/bad+code
Del: spam -- https://master.php.net/note/delete/123582/spam
Del: non-english -- https://master.php.net/note/delete/123582/non-english
Del: in docs -- https://master.php.net/note/delete/123582/in+docs
Del: other reasons-- https://master.php.net/note/delete/123582
Reject -- https://master.php.net/note/reject/123582
Search -- https://master.php.net/manage/user-notes.php