Req #63793 [Opn->Dup]: Provide direct access to socket errors without php_sockets

From: Date: Tue, 27 Jul 2021 13:45:34 +0000
Subject: Req #63793 [Opn->Dup]: Provide direct access to socket errors without php_sockets
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-235405@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=63793&edit=1 ID: 63793 Updated by: cmb@php.net Reported by: chrisw at networkm dot co dot uk Summary: Provide direct access to socket errors without php_sockets -Status: Open +Status: Duplicate Type: Feature/Change Request Package: Streams related Operating System: Any PHP Version: Irrelevant -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: This is a duplicate of bug #34380. Previous Comments: ------------------------------------------------------------------------ [2012-12-18 00:19:44] chrisw at networkm dot co dot uk Description: ------------ Would it be possible to provide access to socket error codes/messages without the need to import the underlying socket into php_sockets? It is often desirable to access the error information when a socket operation fails, and currently this is only possible via socket_import_stream, and subsequent calls to socket_last_error/socket_strerror. This is only possible if php_sockets is available to the PHP installation, which is frequently not the case. Test script: --------------- <?php $socket = stream_socket_client('tcp://11.22.33.44:123'); if (fwrite($socket, 'some data') === false) { $errCode = stream_socket_error($socket); echo 'Sending data failed: Socket error #'.$errCode; } Expected result: ---------------- Sending data failed: Socket error #<error code> Actual result: -------------- Fatal error - stream_socket_error or an equivalent function does not exist ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=63793&edit=1

« previous php.bugs (#235405) next »