[php-src] master: Merge branch 'PHP-7.4' into PHP-8.0
| From: | Christoph M. Becker | Date: | Tue, 20 Apr 2021 16:33:42 +0000 |
| Subject: | [php-src] master: Merge branch 'PHP-7.4' into PHP-8.0 | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-115709@lists.php.net to get a copy of this message | ||
Author: Christoph M. Becker (cmb69)
Date: 2021-04-20T18:30:25+02:00
Commit: https://github.com/php/php-src/commit/3c6480552d0c1ac87e6dfe02bb269b2e11a21de0
Raw diff: https://github.com/php/php-src/commit/3c6480552d0c1ac87e6dfe02bb269b2e11a21de0.diff
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
Fix php_pgsql_fd_cast() wrt. php_stream_can_cast()
Changed paths:
M NEWS
M ext/pgsql/pgsql.c
Diff:
diff --git a/NEWS b/NEWS
index 27b88eb0d16d6..82f14f77493f5 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,9 @@ PHP NEWS
. Fixed bug #80960 (opendir() warning wrong info when failed on Windows).
(cmb)
+- pgsql:
+ . Fixed php_pgsql_fd_cast() wrt. php_stream_can_cast(). (cmb)
+
- SPL:
. Fixed bug #80933 (SplFileObject::DROP_NEW_LINE is broken for NUL and CR).
(cmb, Nikita)
diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c
index 7ea7d199ea4b7..70a78643fa54a 100644
--- a/ext/pgsql/pgsql.c
+++ b/ext/pgsql/pgsql.c
@@ -4142,16 +4142,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;
}