Bug #67965 [NEW]: Regression: stream_select blocks when using tls

From: Date: Fri, 05 Sep 2014 10:28:53 +0000
Subject: Bug #67965 [NEW]: Regression: stream_select blocks when using tls
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-187427@lists.php.net to get a copy of this message
From: arjen at react dot com Operating system: Linux PHP version: 5.5Git-2014-09-05 (Git) Package: Streams related Bug Type: Bug Bug description:Regression: stream_select blocks when using tls Description: ------------ stream_select blocks if there is still data in the read buffer which you haven't read yet.. Testscripts reads 8096 bytes (default chunksize) but there's already more to read. We expect stream_select to return $read again but it won't. This works fine in 5.5.16 and previous versions. Broken by https://github.com/php/php-src/commit/32be79dcfa1bc5af8682d9f512da68c5b3e2cbf3 https://bugs.php.net/bug.php?id=65137 Btw, tested using PHP5.5.16RC1 from http://downloads.php.net/jpauli/php-5.5.17RC1.tar.gz Test script: --------------- <?php $host = 'tcp://php.net:443'; $chunkSize = 8192; $fp = stream_socket_client($host, $errNumber, $errString, 5, STREAM_CLIENT_CONNECT); stream_socket_enable_crypto($fp, true, STREAM_CRYPTO_METHOD_TLS_CLIENT); $data = "GET / HTTP/1.1\r\nConnection: close\r\nHost: php.net\r\n\r\n"; fwrite($fp, $data); while (!feof($fp)) { $read = array($fp); $except = $write = null; $changed = stream_select($read, $write, $except, 5, 0); if (!empty($read)) { $read = fread($fp, $chunkSize); echo 'read ' . strlen($read) . PHP_EOL; } } Expected result: ---------------- read 8192 read 8192 read 8192 read 5961 Actual result: -------------- read 8192 read 8192 and script hangs.. -- Edit bug report at https://bugs.php.net/bug.php?id=67965&edit=1 --

« previous php.bugs (#187427) next »