Skip to content

Commit 1e951ab

Browse files
committed
Fix GH-12190: stream_context_create with address and port at 0.
Prior to the 8.1 rewrite, inet_aton was used for ipv4 addresses therefore addresses like `0` passed. For the bindto's case where both ip and port are set as such, we discard the address binding.
1 parent 5286bab commit 1e951ab

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
--TEST--
2+
Bug #12190 (Setting 0 with port 0 too)
3+
--SKIPIF--
4+
<?php
5+
if (getenv("SKIP_ONLINE_TESTS")) die('skip online test');
6+
if (!in_array('https', stream_get_wrappers())) die('skip: https wrapper is required');
7+
?>
8+
--FILE--
9+
<?php
10+
$context = stream_context_create(['socket' => ['bindto' => '0:0']]);
11+
var_dump(file_get_contents('https://httpbin.org/get', false, $context) !== false);
12+
?>
13+
--EXPECT--
14+
bool(true)

0 commit comments

Comments
 (0)