From bdca73cc142ae682cdfea3b21b89354fad346ffe Mon Sep 17 00:00:00 2001 From: Niels Dossche <7771979+nielsdos@users.noreply.github.com> Date: Thu, 17 Jul 2025 20:22:10 +0200 Subject: [PATCH 1/3] ext/hash: Remove incorrect zval_ptr_dtor --- ext/hash/hash.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/ext/hash/hash.c b/ext/hash/hash.c index 19d72ed7699..58b68fc63b9 100644 --- a/ext/hash/hash.c +++ b/ext/hash/hash.c @@ -850,8 +850,6 @@ PHP_FUNCTION(hash_copy) RETVAL_OBJ(Z_OBJ_HANDLER_P(zhash, clone_obj)(Z_OBJ_P(zhash))); if (php_hashcontext_from_object(Z_OBJ_P(return_value))->context == NULL) { - zval_ptr_dtor(return_value); - zend_throw_error(NULL, "Cannot copy hash"); RETURN_THROWS(); } From d11099ae325b0ade036c039f3e6962120c0a1709 Mon Sep 17 00:00:00 2001 From: Niels Dossche <7771979+nielsdos@users.noreply.github.com> Date: Thu, 17 Jul 2025 20:22:16 +0200 Subject: [PATCH 2/3] ext/socket: Remove incorrect zval_ptr_dtor --- ext/sockets/sockets.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/ext/sockets/sockets.c b/ext/sockets/sockets.c index c252dc6e07a..a0d5e52458f 100644 --- a/ext/sockets/sockets.c +++ b/ext/sockets/sockets.c @@ -2511,7 +2511,6 @@ PHP_FUNCTION(socket_addrinfo_bind) } default: close(php_sock->bsd_socket); - zval_ptr_dtor(return_value); zend_argument_value_error(1, "must be one of AF_UNIX, AF_INET, or AF_INET6"); RETURN_THROWS(); } @@ -2575,7 +2574,6 @@ PHP_FUNCTION(socket_addrinfo_connect) default: zend_argument_value_error(1, "socket type must be one of AF_UNIX, AF_INET, or AF_INET6"); close(php_sock->bsd_socket); - zval_ptr_dtor(return_value); RETURN_THROWS(); } From 86aaded7e57dd2b2f5a4dd4e6a6d9511e6aec4e7 Mon Sep 17 00:00:00 2001 From: Niels Dossche <7771979+nielsdos@users.noreply.github.com> Date: Thu, 17 Jul 2025 21:51:46 +0200 Subject: [PATCH 3/3] NEWS for GH-19162 Closes GH-19162. --- NEWS | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/NEWS b/NEWS index 06427de7f96..cbd68f4ce74 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,9 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? ????, PHP 8.3.25 +- Hash: + . Fix crash on clone failure. (nielsdos) + - LDAP: . Fixed bug GH-18529 (additional inheriting of TLS int options). (Jakub Zelenka) @@ -11,6 +14,8 @@ PHP NEWS return value check). (nielsdos, botovq) . Fix error return check of EVP_CIPHER_CTX_ctrl(). (nielsdos) +- Sockets: + . Fix some potential crashes on incorrect argument value. (nielsdos) 31 Jul 2025, PHP 8.3.24