1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Merge branch 'PHP-8.3'

This commit is contained in:
David Carlier
2023-09-24 15:21:10 +01:00
2 changed files with 16 additions and 2 deletions

View File

@@ -0,0 +1,14 @@
--TEST--
Bug #12190 (Setting 0 with port 0 too)
--SKIPIF--
<?php
if (getenv("SKIP_ONLINE_TESTS")) die('skip online test');
if (!in_array('https', stream_get_wrappers())) die('skip: https wrapper is required');
?>
--FILE--
<?php
$context = stream_context_create(['socket' => ['bindto' => '0:0']]);
var_dump(file_get_contents('https://httpbin.org/get', false, $context) !== false);
?>
--EXPECT--
bool(true)

View File

@@ -835,8 +835,8 @@ php_socket_t php_network_connect_socket_to_host(const char *host, unsigned short
case AF_INET:
((struct sockaddr_in *)sa)->sin_port = htons(port);
socklen = sizeof(struct sockaddr_in);
if (bindto && strchr(bindto, ':')) {
/* IPV4 sock cannot bind to IPV6 address */
if (bindto && (strchr(bindto, ':') || !strcmp(bindto, "0"))) {
/* IPV4 sock can not bind to IPV6 address */
bindto = NULL;
}
break;