php / php/php-src

Socket maximum timeout of 2147 seconds?

オープン
#17,717 コメント 2 件 リアクション 1 件 担当者 1 名 GitHub で見る

@cmb69 がすでに取り組んでいます。

2025年2月6日 から。

  • #17720 @cmb69 による — オープン
Bug Extension: standard OS: Windows Status: Verified
主要言語
C
スター
40.4k
フォーク
8.1k
平均マージ
2日 13時間
マージ済み PR(30日)
96

説明

Description

The following code:

<?php
$url = 'https://example.com/';
$context = stream_context_create([
  'http' => [
    'timeout' => 60 * 60,
  ],
]);
file_get_contents($url, false, $context);

Resulted in this output:

file_get_contents(https://example.com/): Failed to open stream: timeout must be lower than 2147

But I expected this output instead:

No warning/error

Relavant code for the max value from the output ( floor((2^31 -1) / 1000000 ) = 2147 ):
https://github.com/php/php-src/blob/cdaa69e1224bac08be5cdca58191e096613c5766/ext/standard/http_fopen_wrapper.c#L245-L251
Dividing by 100000.0 doesn't seem right.

The timeout struct accepts two long integers, one for seconds and one for micro seconds so the maximum value should be 2147483647.999999 seconds.

https://github.com/php/php-src/blob/cdaa69e1224bac08be5cdca58191e096613c5766/ext/standard/http_fopen_wrapper.c#L259-L265

My php binary is from https://windows.php.net/downloads/releases/php-8.4.3-Win32-vs17-x64.zip

PHP Version

PHP 8.4.3 x64

Operating System

Windows 10

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。