Edit report at http://bugs.php.net/bug.php?id=50866&edit=1
ID: 50866 Updated by: fel...@php.net Reported by: nj506 at zepler dot net Summary: stream_socket_enable_crypto() hangs for unnegotiable SSL connections for socket -Status: No Feedback +Status: Feedback Type: Bug Package: Streams related Operating System: Linux PHP Version: 5.3.1 New Comment: Please try using this snapshot: http://snaps.php.net/php5.3-latest.tar.gz For Windows: http://windows.php.net/snapshots/ Previous Comments: ------------------------------------------------------------------------ [2010-02-05 01:00:00] php-bugs at lists dot php dot net No feedback was provided for this bug for over a week, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open". ------------------------------------------------------------------------ [2010-01-28 08:37:22] j...@php.net Please try using this snapshot: http://snaps.php.net/php5.3-latest.tar.gz For Windows: http://windows.php.net/snapshots/ ------------------------------------------------------------------------ [2010-01-27 22:14:18] nj506 at zepler dot net 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. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=50866&edit=1