From 594e8e22e254879b351c2bbac06264f4c5eda403 Mon Sep 17 00:00:00 2001 From: Holger Woltersdorf Date: Thu, 23 Feb 2017 23:07:59 +0100 Subject: [PATCH] Fixes erroneous response returned by sendRequest and waitForResponse methods, closes #1 --- CHANGELOG.md | 11 +++++++++++ README.md | 41 +++++++++++++++++++++++++++++++++++++++++ src/Client.php | 5 +++-- 3 files changed, 55 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 814c1f0..c4c15cf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,16 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/) and [Keep a CHANGELOG](http://keepachangelog.com). +## [2.0.1] - 2017-02-23 + +### Fixed + +- Erroneous response returned by Client::sendRequest() and Client::waitForResponse() - [#1](https://github.com/hollodotme/fast-cgi-client/issues/1) + +### Changed + +- Testsuite updated for PHPUnit >= 6 + ## [2.0.0] - 2017-01-03 ### Changed @@ -37,5 +47,6 @@ Based on [Pierrick Charron](https://github.com/adoy)'s [PHP-FastCGI-Client](http * Getters/Setters for connect timeout, read/write timeout, keep alive, socket persistence from `Client` (now part of the socket connection) * Method `Client->getValues()` +[2.0.1]: https://github.com/hollodotme/fast-cgi-client/compare/v2.0.0...v2.0.1 [2.0.0]: https://github.com/hollodotme/fast-cgi-client/compare/v1.0.0...v2.0.0 [1.0.0]: https://github.com/hollodotme/fast-cgi-client/tree/v1.0.0 diff --git a/README.md b/README.md index 9338d25..7d4f610 100644 --- a/README.md +++ b/README.md @@ -194,6 +194,47 @@ $response = $client->waitForResponse( ); ``` +### Responses + +Assuming `/path/to/target/script.php` has the following content: + +```php +socket, $response['paddingLength'] ); + fread( $this->socket, $response['paddingLength'] ); } return $response; @@ -349,7 +349,8 @@ public function waitForResponse( int $requestId, int $timeoutMs = 0 ) : string throw new TimedoutException( 'Timed out' ); } - } while ( $packet ); + } + while ( null !== $packet ); if ( $packet === null ) {