Bug #72456 [Fbk->NoF]: Buffer output in stream_socket_client
| From: | php-bugs at lists dot php dot net | Date: | Sun, 13 Jun 2021 04:22:13 +0000 |
| Subject: | Bug #72456 [Fbk->NoF]: Buffer output in stream_socket_client | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-234384@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=72456&edit=1
ID: 72456
Updated by: php-bugs@lists.php.net
Reported by: piotroo89 at gmail dot com
Summary: Buffer output in stream_socket_client
-Status: Feedback
+Status: No Feedback
Type: Bug
Package: OpenSSL related
Operating System: Debian
PHP Version: 5.6.22
Assigned To: cmb
Private report: N
New Comment:
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
Previous Comments:
------------------------------------------------------------------------
[2021-05-31 14:40:44] cmb@php.net
Is this still an issue with any of the actively supported PHP
versions[1]?
[1] <https://www.php.net/supported-versions.php>
------------------------------------------------------------------------
[2016-06-20 09:23:10] piotroo89 at gmail dot com
Description:
------------
I have a problem with stream socket and SSL in PHP 5.6. It seems that SSL is buffering output. In
the example below "ehlo" command is ignored (server is not responding). But when something
else is sent after "ehlo" e.g. a new line in another call to fwrite, server sends
response.
I've tried using stunnel to check if it's a PHP SSL wrapper issue and when I change $host
to $host = 'localhost:110;' (my stunnel configuration) everything works perfectly (without
adding that special fwrite method).
In PHP 5.4.45 this case work perfectly.
Test script:
---------------
$streamContext = stream_context_create();
$host = 'ssl://smtp.some.server.com:465';
$stream = stream_socket_client($host, $errno, $errstr, $timeout, STREAM_CLIENT_CONNECT,
$streamContext);
stream_set_blocking($stream, 1);
stream_set_timeout($stream, $timeout);
stream_set_write_buffer($stream, 0);
$fgets = fgets($stream);
print_r($fgets);
fwrite($stream, "ehlo [127.0.0.1]\r\n");
fwrite($stream, "\r\n"); //when I write this into socket result is OK, without this socket
seems to be buffered
$response = '';
do {
$line = fgets($stream);
$response .= $line;
} while (null !== $line && false !== $line && ' ' != $line{3});
print_r($response);
Expected result:
----------------
220 epicserver.net.pl ESMTP IdeaSmtpServer v0.80.2 ready.
250-epicserver.net.pl Hello ip-166-242.pl [94.183.162.232], pleased to meet you
250-PIPELINING
250-ENHANCEDSTATUSCODES
250-SIZE
250-8BITMIME
250-AUTH PLAIN LOGIN
250-AUTH=PLAIN LOGIN
250 HELP
Actual result:
--------------
220 epicserver.net.pl ESMTP IdeaSmtpServer v0.80.2 ready.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=72456&edit=1