Merge branch 'PHP-8.3' into PHP-8.4

This commit is contained in:
David Carlier 2024-09-30 18:11:25 +01:00
commit 4ad12bdd2d
No known key found for this signature in database
GPG Key ID: 8486F847B4B94EF1
2 changed files with 17 additions and 1 deletions

View 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)

View File

@ -160,7 +160,7 @@ PHPAPI int php_poll2(php_pollfd *ufds, unsigned int nfds, int timeout);
/* timeval-to-timeout (for poll(2)) */
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 -1;