mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Merge branch 'PHP-8.0' into PHP-8.1
This commit is contained in:
commit
c9fa98a174
4 changed files with 47 additions and 0 deletions
4
NEWS
4
NEWS
|
@ -36,6 +36,10 @@ PHP NEWS
|
|||
- SQLite3:
|
||||
. Fixed bug GH-9032 (SQLite3 authorizer crashes on NULL values). (cmb)
|
||||
|
||||
- Streams:
|
||||
. Fixed bug GH-8472 (The resource returned by stream_socket_accept may have
|
||||
incorrect metadata). (Jakub Zelenka)
|
||||
|
||||
04 Aug 2022, PHP 8.1.9
|
||||
|
||||
- CLI:
|
||||
|
|
|
@ -2294,6 +2294,10 @@ static inline int php_openssl_tcp_sockop_accept(php_stream *stream, php_openssl_
|
|||
memcpy(clisockdata, sock, sizeof(clisockdata->s));
|
||||
|
||||
clisockdata->s.socket = clisock;
|
||||
#ifdef __linux__
|
||||
/* O_NONBLOCK is not inherited on Linux */
|
||||
clisockdata->s.is_blocked = 1;
|
||||
#endif
|
||||
|
||||
xparam->outputs.client = php_stream_alloc_rel(stream->ops, clisockdata, NULL, "r+");
|
||||
if (xparam->outputs.client) {
|
||||
|
|
35
ext/standard/tests/streams/gh8472.phpt
Normal file
35
ext/standard/tests/streams/gh8472.phpt
Normal file
|
@ -0,0 +1,35 @@
|
|||
--TEST--
|
||||
GH-8472: The resource returned by stream_socket_accept may have incorrect metadata
|
||||
--FILE--
|
||||
<?php
|
||||
function setNonBlocking($stream)
|
||||
{
|
||||
$block = stream_get_meta_data($stream)['blocked'];
|
||||
if ($block) {
|
||||
stream_set_blocking($stream, false);
|
||||
}
|
||||
}
|
||||
|
||||
$server = stream_socket_server("tcp://127.0.0.1:9100");
|
||||
setNonBlocking($server);
|
||||
|
||||
$client = stream_socket_client("tcp://127.0.0.1:9100");
|
||||
|
||||
$res = stream_socket_accept($server);
|
||||
stream_set_timeout($res, 1);
|
||||
setNonBlocking($res);
|
||||
|
||||
fwrite($client, str_repeat('0', 5));
|
||||
|
||||
$read = [$res];
|
||||
$write = [];
|
||||
$except = [];
|
||||
|
||||
if (stream_select($read, $write, $except, 1)) {
|
||||
var_dump(fread($res, 4));
|
||||
var_dump(fread($res, 4));
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
||||
string(4) "0000"
|
||||
string(1) "0"
|
|
@ -841,6 +841,10 @@ static inline int php_tcp_sockop_accept(php_stream *stream, php_netstream_data_t
|
|||
|
||||
memcpy(clisockdata, sock, sizeof(*clisockdata));
|
||||
clisockdata->socket = clisock;
|
||||
#ifdef __linux__
|
||||
/* O_NONBLOCK is not inherited on Linux */
|
||||
clisockdata->is_blocked = 1;
|
||||
#endif
|
||||
|
||||
xparam->outputs.client = php_stream_alloc_rel(stream->ops, clisockdata, NULL, "r+");
|
||||
if (xparam->outputs.client) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue