Req #70939 [Com]: socket_import_stream does not indicate missing support for SSL

From: Date: Mon, 13 Jan 2020 10:36:56 +0000
Subject: Req #70939 [Com]: socket_import_stream does not indicate missing support for SSL
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-224875@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=70939&edit=1 ID: 70939 Comment by: alex dot bucher at myposter dot de Reported by: lcharron at meditech dot com Summary: socket_import_stream does not indicate missing support for SSL Status: Open Type: Feature/Change Request Package: Sockets related Operating System: Any PHP Version: 5.5.30 Block user comment: N Private report: N New Comment: Hi There, 4 Years later - any updates / workarounds for this? just hitting the Problem with https://github.com/php-amqplib/php-amqplib/issues/371 currently adding TICKS and a tickhandler as a workaround, but that's not a really nice solution... Previous Comments: ------------------------------------------------------------------------ [2016-02-23 10:02:59] adrian dot sandu at asandu dot eu Someone recommended: $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); socket_set_option($socket, SOL_SOCKET, SO_KEEPALIVE, 1); socket_connect($socket, $host, $port); ------------------------------------------------------------------------ [2016-02-22 17:52:43] lcharron at meditech dot com I could find no work around. ------------------------------------------------------------------------ [2016-02-21 19:47:19] adrian dot sandu at asandu dot eu Any updates/workarounds ? ------------------------------------------------------------------------ [2015-12-12 18:16:24] contact at sshilko dot com Same issue, i thought its "by design", at the moment there is no option to enable SO_KEEPALIVE when using stream_socket_client() with SSL/TLS ------------------------------------------------------------------------ [2015-11-18 20:33:10] lcharron at meditech dot com Description: ------------ You should be able to obtain the socket from a socket-based SSL stream so that socket options (ex. SO_KEEPALIVE) can be set. The documentation makes no mention that this is not possible. Test script: --------------- $host = "host"; $port = "443"; $stream = stream_socket_client("ssl://{$host}:{$port}"); $socket = socket_import_stream($stream); if ($socket) { socket_set_option($socket, SOL_SOCKET, SO_KEEPALIVE, 1); } Expected result: ---------------- socket_import_stream should return the underlying socket so options can be set. Actual result: -------------- socket_import_stream returns null and the following warning is emitted: Warning: socket_import_stream(): cannot represent a stream of type tcp_socket/ssl as a Socket Descriptor in ... ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=70939&edit=1

« previous php.bugs (#224875) next »