summaryrefslogtreecommitdiff
path: root/ext/sockets
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2019-05-23 11:12:34 +0200
committerNikita Popov <nikita.ppv@gmail.com>2019-05-23 11:12:59 +0200
commitb394654c1eb35f99aa356dacd73e2249be4278cc (patch)
tree4ccbf05f2196ebcc281d9f676f71a499384e5775 /ext/sockets
parentd4867e099e7f0919bd7897d1303c0d00671509cc (diff)
parent9a74b23297167ca7956fd21428c8b987e7d99aa5 (diff)
downloadphp-git-b394654c1eb35f99aa356dacd73e2249be4278cc.tar.gz
Merge branch 'PHP-7.2' into PHP-7.3
Diffstat (limited to 'ext/sockets')
-rw-r--r--ext/sockets/sockets.c2
-rw-r--r--ext/sockets/tests/socket_select.phpt1
2 files changed, 3 insertions, 0 deletions
diff --git a/ext/sockets/sockets.c b/ext/sockets/sockets.c
index 10e216a51b..2e870bfc8e 100644
--- a/ext/sockets/sockets.c
+++ b/ext/sockets/sockets.c
@@ -898,6 +898,7 @@ static int php_sock_array_to_fd_set(zval *sock_array, fd_set *fds, PHP_SOCKET *m
if (Z_TYPE_P(sock_array) != IS_ARRAY) return 0;
ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(sock_array), element) {
+ ZVAL_DEREF(element);
php_sock = (php_socket*) zend_fetch_resource_ex(element, le_socket_name, le_socket);
if (!php_sock) continue; /* If element is not a resource, skip it */
@@ -926,6 +927,7 @@ static int php_sock_array_from_fd_set(zval *sock_array, fd_set *fds) /* {{{ */
array_init(&new_hash);
ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(sock_array), num_key, key, element) {
+ ZVAL_DEREF(element);
php_sock = (php_socket*) zend_fetch_resource_ex(element, le_socket_name, le_socket);
if (!php_sock) continue; /* If element is not a resource, skip it */
diff --git a/ext/sockets/tests/socket_select.phpt b/ext/sockets/tests/socket_select.phpt
index 3896a09169..5d55111995 100644
--- a/ext/sockets/tests/socket_select.phpt
+++ b/ext/sockets/tests/socket_select.phpt
@@ -17,6 +17,7 @@ socket_create_pair($domain, SOCK_STREAM, 0, $sockets);
$write = null;
$except = null;
+$ref =& $sockets[0]; // bug #78038
var_dump(socket_select($sockets, $write, $except, 0));
--EXPECT--
int(0)