Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fix error checking on Zend\Http\Client\Adapter\Socket->write(). #3033

Closed
wants to merge 1 commit into from

3 participants

@peterhil

This failed on CLI usage, giving:
Notice: fwrite(): send of 8192 bytes failed with errno=32 Broken pipe in [a-symfony-project-name-held]/vendor/zendframework/zendframework/library/Zend/Http/Client/Adapter/Socket.php on line 361

The PHP fwrite function can returns the bytes written, which can be 0 – and returns false on error:
"fwrite() returns the number of bytes written, or FALSE on error."
http://php.net/manual/en/function.fwrite.php

This breaks the ZendService\Amazon\S3\S3->putFile(), when called from a CLI PHP script (using Symfony console).

@peterhil peterhil referenced this pull request in xi-project/xi-filelib
Closed

Fixed Amazon S3 client #104

@Ocramius
Collaborator

@peterhil can you please test this by writing an empty string to the socket?

Nevermind, I'm trying to write the test myself :)

@Ocramius Ocramius referenced this pull request from a commit in Ocramius/zf2
@Ocramius Ocramius Adding failing test for zendframework/zf2#3033 0c8554b
@Ocramius Ocramius referenced this pull request
Closed

Hotfix/issue #3033 #3049

@Ocramius
Collaborator

Handled in #3049

@weierophinney weierophinney closed this pull request from a commit
@weierophinney weierophinney Merge branch 'hotfix/3049'
Fixes #3033
Close #3049
b052599
@ghost Unknown referenced this pull request from a commit
@Ocramius Ocramius Adding failing test for zendframework/zf2#3033 d60dae5
@ghost Unknown referenced this pull request from a commit
@weierophinney weierophinney Merge branch 'hotfix/issue-#3033' of git://github.com/Ocramius/zf2 in…
…to hotfix/3049
69b18c8
@ghost Unknown referenced this pull request from a commit
@weierophinney weierophinney Merge branch 'hotfix/3049'
Fixes #3033
Close #3049
65cf549
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 1 deletion.
  1. +1 −1  library/Zend/Http/Client/Adapter/Socket.php
View
2  library/Zend/Http/Client/Adapter/Socket.php
@@ -360,7 +360,7 @@ public function write($method, $uri, $http_ver = '1.1', $headers = array(), $bod
ErrorHandler::start();
$test = fwrite($this->socket, $request);
$error = ErrorHandler::stop();
- if (!$test) {
+ if (false === $test) {
throw new AdapterException\RuntimeException('Error writing request to server', 0, $error);
}
Something went wrong with that request. Please try again.