mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Merge branch 'PHP-8.4'
This commit is contained in:
commit
9e6774d043
2 changed files with 17 additions and 1 deletions
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;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue