Skip to content

socket_select() missing note that array keys are preserved #5787

Description

@eXory2024

Affected page

http://php.net/socket_select

Current issue

The socket_select() is equivalent in operation to stream_select() according to the documentation of stream_select():

The stream_select() function accepts arrays of streams and waits for them to change status. Its operation is equivalent to that of the socket_select() function except in that it acts on streams.

However, only stream_select contains the note telling the user that the array keys are preserved:

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.

If the behaviour is really the same - which according to some tests I did - it is, then this should be documented in socket_select() as well; otherwise, it's not completely clear if users can rely on the array keys being preserved with this function, for example, take a look at a comment on the socket_select page:

Just to add to this. Since the information contained in the notes is somewhat old. It appears keys are being preserved now.

Suggested improvement

Adding the note:

When socket_select() returns, the arrays read, write and except are modified to indicate which socket(s) actually changed status. The original keys of the arrays are preserved.

Additional context (optional)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions