diff --git a/NEWS b/NEWS index d35d34b84e96b..a06ac7f852587 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,12 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| -?? ??? ????, PHP 8.5.0alpha2 +?? ??? ????, PHP 8.5.0alpha3 + +- Sockets: + . socket_set_option for multicast context throws a ValueError + when the socket family is not of AF_INET/AF_INET6 family. (David Carlier) + +17 Jul 2025, PHP 8.5.0alpha2 - Core: . Fix OSS-Fuzz #427814452 (pipe compilation fails with assert). diff --git a/UPGRADING b/UPGRADING index 0847ad009e781..87d08e1260150 100644 --- a/UPGRADING +++ b/UPGRADING @@ -371,6 +371,8 @@ PHP 8.5 UPGRADE NOTES . socket_create/socket_bind can create AF_PACKET family sockets. . socket_getsockname gets the interface index and its string 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::__construct/parseFile/parseString now throws a ValueError diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c index 6e7d31e15a40f..01f6d924d28f6 100644 --- a/Zend/zend_opcode.c +++ b/Zend/zend_opcode.c @@ -709,7 +709,7 @@ static void zend_check_finally_breakout(zend_op_array *op_array, uint32_t op_num } } -static uint32_t zend_get_brk_cont_target(const zend_op_array *op_array, const zend_op *opline) { +static uint32_t zend_get_brk_cont_target(const zend_op *opline) { int nest_levels = opline->op2.num; int array_offset = opline->op1.num; zend_brk_cont_element *jmp_to; @@ -1120,7 +1120,7 @@ ZEND_API void pass_two(zend_op_array *op_array) case ZEND_BRK: case ZEND_CONT: { - uint32_t jmp_target = zend_get_brk_cont_target(op_array, opline); + uint32_t jmp_target = zend_get_brk_cont_target(opline); if (op_array->fn_flags & ZEND_ACC_HAS_FINALLY_BLOCK) { zend_check_finally_breakout(op_array, opline - op_array->opcodes, jmp_target); diff --git a/ext/openssl/openssl_backend_common.c b/ext/openssl/openssl_backend_common.c index 4dc8fd27f224f..184ea2e205cc9 100644 --- a/ext/openssl/openssl_backend_common.c +++ b/ext/openssl/openssl_backend_common.c @@ -440,7 +440,7 @@ zend_result php_openssl_load_rand_file(const char * file, int *egdsocket, int *s return SUCCESS; #endif } - if (file == NULL || !RAND_load_file(file, -1)) { + if (file == NULL || RAND_load_file(file, -1) < 0) { if (RAND_status() == 0) { php_openssl_store_errors(); php_error_docref(NULL, E_WARNING, "Unable to load random state; not enough random data!"); @@ -465,7 +465,7 @@ zend_result php_openssl_write_rand_file(const char * file, int egdsocket, int se if (file == NULL) { file = RAND_file_name(buffer, sizeof(buffer)); } - if (file == NULL || !RAND_write_file(file)) { + if (file == NULL || RAND_write_file(file) < 0) { php_openssl_store_errors(); php_error_docref(NULL, E_WARNING, "Unable to write random state"); return FAILURE; diff --git a/ext/sockets/sockaddr_conv.c b/ext/sockets/sockaddr_conv.c index 9840a98dbcb72..333ef2533a11b 100644 --- a/ext/sockets/sockaddr_conv.c +++ b/ext/sockets/sockaddr_conv.c @@ -137,8 +137,7 @@ int php_set_inet46_addr(php_sockaddr_storage *ss, socklen_t *ss_len, zend_string } #endif else { - php_error_docref(NULL, E_WARNING, - "IP address used in the context of an unexpected type of socket"); + zend_value_error("IP address used in the context of an unexpected type of socket"); } return 0; } diff --git a/ext/sockets/tests/mcast_sockettype_error.phpt b/ext/sockets/tests/mcast_sockettype_error.phpt new file mode 100644 index 0000000000000..56308534ebc4d --- /dev/null +++ b/ext/sockets/tests/mcast_sockettype_error.phpt @@ -0,0 +1,30 @@ +--TEST-- +Multicast attempt on unsupported socket type +--EXTENSIONS-- +sockets +--SKIPIF-- + +--FILE-- + '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 diff --git a/ext/xml/compat.c b/ext/xml/compat.c index cafb19c2c1edd..ea72a958006e2 100644 --- a/ext/xml/compat.c +++ b/ext/xml/compat.c @@ -355,7 +355,9 @@ get_entity(void *user, const xmlChar *name) if (ret == NULL) ret = xmlGetDocEntity(parser->parser->myDoc, name); + ZEND_DIAGNOSTIC_IGNORED_START("-Wdeprecated-declarations") if (ret == NULL || parser->parser->instate == XML_PARSER_CONTENT) { + ZEND_DIAGNOSTIC_IGNORED_END if (ret == NULL || ret->etype == XML_INTERNAL_GENERAL_ENTITY || ret->etype == XML_INTERNAL_PARAMETER_ENTITY || ret->etype == XML_INTERNAL_PREDEFINED_ENTITY) { /* Predefined entities will expand unless no cdata handler is present */ if (parser->h_default && ! (ret && ret->etype == XML_INTERNAL_PREDEFINED_ENTITY && parser->h_cdata)) {