Skip to content

Cleaning up types in php_stdiop_cast #17524

Open
@bukka

Description

@bukka

The whole php_stdiop_cast is a proper mess. It defines php_socket_t fd but then it uses PHP_STDIOP_GET_FD which is defined as

#define PHP_STDIOP_GET_FD(anfd, data)	anfd = (data)->file ? fileno((data)->file) : (data)->fd

which is actually always int. I assume that there are some users (external code) that casting and assume that php_socket_t is returned but I think this is incorrect and they should not assume that and it should be fixed there using proper casting. That would leave plain wrapper operating just on fd which is what I think it should.

Then why does it need to even SOCK_ERR here if it's not for socket in the first place? I think it should be redefined just to -1 or some new macro created (e.g. PHP_FD_ERR).

Originally posted by @bukka in #17506 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions