Skip to content

Fix php_pgsql_fd_cast() wrt. php_stream_can_cast() #6888

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions ext/pgsql/pgsql.c
Original file line number Diff line number Diff line change
Expand Up @@ -5418,16 +5418,17 @@ static int php_pgsql_fd_cast(php_stream *stream, int cast_as, void **ret) /* {{{
switch (cast_as) {
case PHP_STREAM_AS_FD_FOR_SELECT:
case PHP_STREAM_AS_FD:
case PHP_STREAM_AS_SOCKETD:
if (ret) {
case PHP_STREAM_AS_SOCKETD: {
int fd_number = PQsocket(pgsql);
if (fd_number == -1) {
return FAILURE;
}

*(php_socket_t *)ret = fd_number;
return SUCCESS;
if (ret) {
*(php_socket_t *)ret = fd_number;
}
}
return SUCCESS;
default:
return FAILURE;
}
Expand Down