mirror of
https://github.com/php/php-src.git
synced 2024-09-21 18:07:23 +00:00
Fixed bug #72075 (Referencing socket resources breaks stream_select)
This commit is contained in:
parent
988bdd0908
commit
9eb7c8cd3b
2
NEWS
2
NEWS
@ -37,6 +37,8 @@ PHP NEWS
|
|||||||
. Fixed bug #68849 (bindValue is not using the right data type). (Anatol)
|
. Fixed bug #68849 (bindValue is not using the right data type). (Anatol)
|
||||||
|
|
||||||
- Standard:
|
- Standard:
|
||||||
|
. Fixed bug #72075 (Referencing socket resources breaks stream_select).
|
||||||
|
(Laruence)
|
||||||
. Fixed bug #72031 (array_column() against an array of objects discards all
|
. Fixed bug #72031 (array_column() against an array of objects discards all
|
||||||
values matching null). (Nikita)
|
values matching null). (Nikita)
|
||||||
|
|
||||||
|
@ -613,6 +613,7 @@ static int stream_array_to_fd_set(zval *stream_array, fd_set *fds, php_socket_t
|
|||||||
the higher bits of a SOCKET variable uninitialized on systems with little endian. */
|
the higher bits of a SOCKET variable uninitialized on systems with little endian. */
|
||||||
php_socket_t this_fd;
|
php_socket_t this_fd;
|
||||||
|
|
||||||
|
ZVAL_DEREF(elem);
|
||||||
php_stream_from_zval_no_verify(stream, elem);
|
php_stream_from_zval_no_verify(stream, elem);
|
||||||
if (stream == NULL) {
|
if (stream == NULL) {
|
||||||
continue;
|
continue;
|
||||||
@ -652,6 +653,7 @@ static int stream_array_from_fd_set(zval *stream_array, fd_set *fds)
|
|||||||
ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(stream_array), num_ind, key, elem) {
|
ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(stream_array), num_ind, key, elem) {
|
||||||
php_socket_t this_fd;
|
php_socket_t this_fd;
|
||||||
|
|
||||||
|
ZVAL_DEREF(elem);
|
||||||
php_stream_from_zval_no_verify(stream, elem);
|
php_stream_from_zval_no_verify(stream, elem);
|
||||||
if (stream == NULL) {
|
if (stream == NULL) {
|
||||||
continue;
|
continue;
|
||||||
@ -698,6 +700,7 @@ static int stream_array_emulate_read_fd_set(zval *stream_array)
|
|||||||
zend_hash_init(Z_ARRVAL(new_array), zend_hash_num_elements(Z_ARRVAL_P(stream_array)), NULL, ZVAL_PTR_DTOR, 0);
|
zend_hash_init(Z_ARRVAL(new_array), zend_hash_num_elements(Z_ARRVAL_P(stream_array)), NULL, ZVAL_PTR_DTOR, 0);
|
||||||
|
|
||||||
ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(stream_array), elem) {
|
ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(stream_array), elem) {
|
||||||
|
ZVAL_DEREF(elem);
|
||||||
php_stream_from_zval_no_verify(stream, elem);
|
php_stream_from_zval_no_verify(stream, elem);
|
||||||
if (stream == NULL) {
|
if (stream == NULL) {
|
||||||
continue;
|
continue;
|
||||||
|
15
ext/standard/tests/streams/bug72075.phpt
Normal file
15
ext/standard/tests/streams/bug72075.phpt
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
--TEST--
|
||||||
|
Bug #72075 (Referencing socket resources breaks stream_select)
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
$r = [stream_socket_server("tcp://127.0.0.1:0", $errno, $errStr)];
|
||||||
|
$w = NULL;
|
||||||
|
$e = NULL;
|
||||||
|
|
||||||
|
// Without this line, all is well:
|
||||||
|
$dummy =& $r[0];
|
||||||
|
|
||||||
|
print stream_select($r, $w, $e, 0.5);
|
||||||
|
|
||||||
|
--EXPECT--
|
||||||
|
0
|
Loading…
Reference in New Issue
Block a user