Commit dc04dc6f authored by skummer's avatar skummer

ZP-167

- potential fix: check if fread() returns an error false or the stream is unavailable

git-svn-id: https://z-push.org/svn/z-push/trunk@1397 b7dd7b3b-3a3c-0410-9da9-bee62a6cc5b5
parent 1840b0bf
......@@ -562,7 +562,15 @@ class WBXMLDecoder extends WBXMLDefs {
$l = 0;
while (1) {
$l = (($len - strlen($d)) > 8192) ? 8192 : ($len - strlen($d));
if ($l > 0) $d .= fread($this->in, $l);
if ($l > 0) {
$data = fread($this->in, $l);
// Stream ends prematurely on instable connections and big mails
if ($data === false || feof($this->in))
throw new HTTPReturnCodeException(sprintf("WBXMLDecoder->getOpaque() connection unavailable while trying to read %d bytes from stream. Aborting after %d bytes read.", $len, strlen($d)), HTTP_CODE_500, null, LOGLEVEL_WARN);
else
$d .= $data;
}
if (strlen($d) >= $len) break;
}
return $d;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment