com php-src: Fixed bug #78038 socket_select with referenc es: NEWS ext/sockets/sockets.c ext/sockets/tests/sock et_select.phpt

From: Date: Thu, 23 May 2019 09:12:15 +0000
Subject: com php-src: Fixed bug #78038 socket_select with referenc es: NEWS ext/sockets/sockets.c ext/sockets/tests/sock et_select.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-106310@lists.php.net to get a copy of this message
Commit: 9a74b23297167ca7956fd21428c8b987e7d99aa5 Author: Nikita Popov <nikita.ppv@gmail.com> Thu, 23 May 2019 11:11:54 +0200 Parents: fa6a4483e63d87608a839d04c6e1b9eed9a0430f Branches: PHP-7.2 PHP-7.3 PHP-7.4 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=9a74b23297167ca7956fd21428c8b987e7d99aa5 Log: Fixed bug #78038 socket_select with references Bugs: https://bugs.php.net/78038 Changed paths: M NEWS M ext/sockets/sockets.c M ext/sockets/tests/socket_select.phpt Diff: diff --git a/NEWS b/NEWS index 827ed8e..1277de3 100644 --- a/NEWS +++ b/NEWS @@ -14,6 +14,10 @@ PHP NEWS . Fixed bug #77956 (When mysqli.allow_local_infile = Off, use a meaningful error message). (Sjon Hortensius) +- Sockets: + . Fixed bug #78038 (Socket_select fails when resource array contains + references). (Nikita) + 30 May 2019, PHP 7.2.19 - FPM: diff --git a/ext/sockets/sockets.c b/ext/sockets/sockets.c index 5c36ff6..6b72474 100644 --- a/ext/sockets/sockets.c +++ b/ext/sockets/sockets.c @@ -853,6 +853,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 */ @@ -881,6 +882,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 3896a09..5d55111 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)

« previous php.cvs (#106310) next »