[php-src] Issue #13603: socket_getsockname returns wrong address on some unix filename

From: Date: Wed, 06 Mar 2024 05:02:30 +0000
Subject: [php-src] Issue #13603: socket_getsockname returns wrong address on some unix filename
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-246517@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/13603 Author: jyxjjj ### Description The following code: ```php <?php $socket = socket_create(AF_UNIX, SOCK_STREAM, 0); socket_bind($socket, 'sn.sock'); socket_listen($socket); socket_getsockname($socket, $address); ``` Resulted in this output: ``` sn.sockxxxxxxxx ``` But I expected this output instead: ``` sn.sock ``` There are more binary string when named as sn.sock (So i will give it all in hex) something like this in hex: 58b30101 changed every time when re-generate sn.sock: 98f6(strange, this time it only 4 length) When a.sock: 9098c10301 90d8800101 s.sock: 90186a0301 (changed every time too) At first i think it is because this string is too short, Then i tried s.s, it always returned s.s correctly. I am using 8.3.1 , I haven't done any more testing, but I have the impression that I met this a long time ago, when I was still a newbie. Seems like from PHP5. I don't have such old env, cannot give more test, sorry ### PHP Version 8.3.1 ### Operating System macOS 14.2.1 23C71

« previous php.bugs (#246517) next »