mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Merge branch 'PHP-8.3' into PHP-8.4
This commit is contained in:
16
ext/standard/tests/streams/gh15937.phpt
Normal file
16
ext/standard/tests/streams/gh15937.phpt
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
--TEST--
|
||||||
|
GH-15937 (stream overflow on timeout setting)
|
||||||
|
--SKIPIF--
|
||||||
|
<?php if (getenv("SKIP_ONLINE_TESTS")) die("skip online test"); ?>
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
$config = [
|
||||||
|
'http' => [
|
||||||
|
'timeout' => PHP_INT_MAX,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
$ctx = stream_context_create($config);
|
||||||
|
var_dump(fopen("http://www.example.com", "r", false, $ctx));
|
||||||
|
?>
|
||||||
|
--EXPECTF--
|
||||||
|
resource(%d) of type (stream)
|
||||||
@@ -160,7 +160,7 @@ PHPAPI int php_poll2(php_pollfd *ufds, unsigned int nfds, int timeout);
|
|||||||
/* timeval-to-timeout (for poll(2)) */
|
/* timeval-to-timeout (for poll(2)) */
|
||||||
static inline int php_tvtoto(struct timeval *timeouttv)
|
static inline int php_tvtoto(struct timeval *timeouttv)
|
||||||
{
|
{
|
||||||
if (timeouttv) {
|
if (timeouttv && timeouttv->tv_sec >= 0 && timeouttv->tv_sec <= ((INT_MAX - 1000) / 1000)) {
|
||||||
return (timeouttv->tv_sec * 1000) + (timeouttv->tv_usec / 1000);
|
return (timeouttv->tv_sec * 1000) + (timeouttv->tv_usec / 1000);
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
Reference in New Issue
Block a user