[php-src] PR #22338: Fix socket_sendmsg() sending wrong fd for Socket objects in SCM_RIGHTS

From: Date: Tue, 16 Jun 2026 21:14:50 +0000
Subject: [php-src] PR #22338: Fix socket_sendmsg() sending wrong fd for Socket objects in SCM_RIGHTS
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-36467@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/22338 Author: iliaal socket_sendmsg() transmits the wrong file descriptors when a Socket object is passed in an SCM_RIGHTS control message: the object branch of from_zval_write_fd_array_aux() indexes the fd array with the 1-based loop counter (iarr[i]) instead of iarr[i - 1] like the resource branch, so slot 0 stays zeroed and a single Socket object delivers fd 0 (stdin) to the receiver instead of the socket. Broken since the 8.0 resource-to-object conversion. The existing socket_cmsg_rights.phpt only asserted is_resource() on the received descriptors, which masked this (the lost socket fd was replaced by stdin, still a stream); it now also accepts Socket objects.

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