[php-src] PR #14207: ext/sockets: Set default values for socket_create parameters

From: Date: Sat, 11 May 2024 18:02:36 +0000
Subject: [php-src] PR #14207: ext/sockets: Set default values for socket_create parameters
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-26119@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/14207 Author: developersharif This pull request proposes a modification to the socket_create function in the PHP Socket extension to set default values for the domain, type, and protocol parameters if the user doesn't provide any arguments. **Changes:** 1. The domain parameter is set to AF_INET (IPv4) on Windows systems, and AF_UNIX (Unix domain sockets) on non-Windows systems. 2. The type parameter is set to SOCK_STREAM (TCP). 3. The protocol parameter is set to SOL_TCP. If the user provides arguments to the socket_create function, those values will override the default values set by this change. **Motivation:** The current behavior of the socket_create function requires users to explicitly provide all three parameters, even in common use cases where the default values would suffice. By setting sensible default values based on the operating system and common use cases, this change aims to simplify socket programming for developers and reduce the need for redundant code. **Testing and Compatibility:** I have performed local testing with various use cases, and the changes seem to work as intended. However, more extensive testing, particularly with existing codebases and edge cases, is recommended to ensure compatibility and identify any potential issues.

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