mirror of
https://github.com/php/php-src.git
synced 2025-08-15 13:38:49 +02:00
ext/sockets: multicast on unsupported socket type error change.
From a mere warning to an exception. close GH-19114
This commit is contained in:
parent
2039664e47
commit
64852b44b5
4 changed files with 37 additions and 2 deletions
4
NEWS
4
NEWS
|
@ -14,6 +14,10 @@ PHP NEWS
|
||||||
. Fetch larger block sizes and better handle SQL_NO_TOTAL when calling
|
. Fetch larger block sizes and better handle SQL_NO_TOTAL when calling
|
||||||
SQLGetData. (Calvin Buckley, Saki Takamachi)
|
SQLGetData. (Calvin Buckley, Saki Takamachi)
|
||||||
|
|
||||||
|
- Sockets:
|
||||||
|
. socket_set_option for multicast context throws a ValueError
|
||||||
|
when the socket family is not of AF_INET/AF_INET6 family. (David Carlier)
|
||||||
|
|
||||||
- Standard:
|
- Standard:
|
||||||
. Optimized pack(). (nielsdos, divinity76)
|
. Optimized pack(). (nielsdos, divinity76)
|
||||||
. Fixed bug GH-19070 (setlocale($type, NULL) should not be deprecated).
|
. Fixed bug GH-19070 (setlocale($type, NULL) should not be deprecated).
|
||||||
|
|
|
@ -371,6 +371,8 @@ PHP 8.5 UPGRADE NOTES
|
||||||
. socket_create/socket_bind can create AF_PACKET family sockets.
|
. socket_create/socket_bind can create AF_PACKET family sockets.
|
||||||
. socket_getsockname gets the interface index and its string
|
. socket_getsockname gets the interface index and its string
|
||||||
representation with AF_PACKET socket.
|
representation with AF_PACKET socket.
|
||||||
|
. socket_set_option with multicast context throws a ValueError
|
||||||
|
when the created socket is not of AF_INET/AF_INET6 family.
|
||||||
|
|
||||||
- Tidy:
|
- Tidy:
|
||||||
. tidy::__construct/parseFile/parseString now throws a ValueError
|
. tidy::__construct/parseFile/parseString now throws a ValueError
|
||||||
|
|
|
@ -137,8 +137,7 @@ int php_set_inet46_addr(php_sockaddr_storage *ss, socklen_t *ss_len, zend_string
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
else {
|
else {
|
||||||
php_error_docref(NULL, E_WARNING,
|
zend_value_error("IP address used in the context of an unexpected type of socket");
|
||||||
"IP address used in the context of an unexpected type of socket");
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
30
ext/sockets/tests/mcast_sockettype_error.phpt
Normal file
30
ext/sockets/tests/mcast_sockettype_error.phpt
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
--TEST--
|
||||||
|
Multicast attempt on unsupported socket type
|
||||||
|
--EXTENSIONS--
|
||||||
|
sockets
|
||||||
|
--SKIPIF--
|
||||||
|
<?php
|
||||||
|
if (substr(PHP_OS, 0, 3) == 'WIN') {
|
||||||
|
die('skip Not for Windows!');
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
$sock_path = sprintf("/tmp/%s.sock", uniqid());
|
||||||
|
|
||||||
|
if (file_exists($sock_path))
|
||||||
|
die('Temporary socket already exists.');
|
||||||
|
$sock = socket_create(AF_UNIX, SOCK_DGRAM, 0);
|
||||||
|
socket_bind($sock, $sock_path);
|
||||||
|
|
||||||
|
try {
|
||||||
|
socket_set_option($sock, IPPROTO_IP, MCAST_JOIN_GROUP, array(
|
||||||
|
"group" => '127.0.0.1',
|
||||||
|
"interface" => "lo",
|
||||||
|
));
|
||||||
|
} catch (\ValueError $e) {
|
||||||
|
echo $e->getMessage(), PHP_EOL;
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
--EXPECT--
|
||||||
|
IP address used in the context of an unexpected type of socket
|
Loading…
Add table
Add a link
Reference in a new issue