|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2010-01-28 08:37 UTC] jani@php.net
[2010-02-05 01:00 UTC] php-bugs at lists dot php dot net
[2010-04-25 20:24 UTC] felipe@php.net
-Status: No Feedback
+Status: Feedback
[2010-04-25 20:24 UTC] felipe@php.net
[2013-02-18 00:34 UTC] php-bugs at lists dot php dot net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 16 06:00:02 2025 UTC |
Description: ------------ stream_socket_enable_crypto() hangs for unnegotiable SSL connections for sockets connected in asynchronous mode. Whilst I'm not greatly familiar with the PHP source, I believe it is caused by the following line of code in xp_ssl.c: timeout -= (tve.tv_sec + (float) tve.tv_usec / 1000000) - (tvs.tv_sec + (float) tvs.tv_usec / 1000000); I'm often seeing no difference in tve.tv_sec and tvs.tv_sec, and the difference between tve.tv_usec and tvs.tv_usec is typically 4/5 microseconds for the particular scenario I've been debugging. 4/1000000 deduction from the timeout float results in essentially no change. Therefore the code loops for a very long time. In anycase, a printf on the timeout float see's no change after running for a good length of time. Note: I don't believe this is the same issue as #45808, since this affects client connections, not server connections [+ the area of code I believe to be guilty is specific to client connections] I'd also note that stream_set_blocking appears to have no effect on this area of code - but I'm not sure if thats a bug or not. Reproduce code: --------------- <?PHP // The given address should not be connectable.. $socket = stream_socket_client("tcp://{$address}", $errno, $errstr, 15, STREAM_CLIENT_CONNECT|STREAM_CLIENT_ASYNC_CONNECT); var_dump(stream_socket_enable_crypto($socket, true, STREAM_CRYPTO_METHOD_SSLv23_CLIENT)); ?> Expected result: ---------------- 0/false [after "timeout" seconds] Actual result: -------------- Hangs pretty much forever.