Skip to content

Commit 3c64805

Browse files
committed
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4: Fix php_pgsql_fd_cast() wrt. php_stream_can_cast()
2 parents 0f40426 + 1fcea24 commit 3c64805

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ PHP NEWS
66
. Fixed bug #80960 (opendir() warning wrong info when failed on Windows).
77
(cmb)
88

9+
- pgsql:
10+
. Fixed php_pgsql_fd_cast() wrt. php_stream_can_cast(). (cmb)
11+
912
- SPL:
1013
. Fixed bug #80933 (SplFileObject::DROP_NEW_LINE is broken for NUL and CR).
1114
(cmb, Nikita)

ext/pgsql/pgsql.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4142,16 +4142,17 @@ static int php_pgsql_fd_cast(php_stream *stream, int cast_as, void **ret) /* {{{
41424142
switch (cast_as) {
41434143
case PHP_STREAM_AS_FD_FOR_SELECT:
41444144
case PHP_STREAM_AS_FD:
4145-
case PHP_STREAM_AS_SOCKETD:
4146-
if (ret) {
4145+
case PHP_STREAM_AS_SOCKETD: {
41474146
int fd_number = PQsocket(pgsql);
41484147
if (fd_number == -1) {
41494148
return FAILURE;
41504149
}
41514150

4152-
*(php_socket_t *)ret = fd_number;
4153-
return SUCCESS;
4151+
if (ret) {
4152+
*(php_socket_t *)ret = fd_number;
4153+
}
41544154
}
4155+
return SUCCESS;
41554156
default:
41564157
return FAILURE;
41574158
}

0 commit comments

Comments
 (0)