[php-src] PR #25937: Fix leak of the stream resource in socket_close()

From: Date: Mon, 30 Nov 2026 10:45:01 +0000
Subject: [php-src] PR #25937: Fix leak of the stream resource in socket_close()
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-41236@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/25937 Author: lacatoire socket_close() on a Socket created by socket_import_stream() or socket_export_stream() only forgot its reference to the stream resource, so the closed resource stayed in the resource list until the end of the request. Release the reference. ### To reproduce ```php <?php $before = count(get_resources()); for ($i = 0; $i < 1000; $i++) { $s = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); $f = socket_export_stream($s); socket_close($s); unset($s, $f); } echo count(get_resources()) - $before, "\n"; ``` Before (8.4.28, 8.5.12, 8.6.0): 1000 After: 0

« previous php.git-pulls (#41236) next »