Commit aafbbdfa authored by Sebastian Kummer's avatar Sebastian Kummer

Merge pull request #67 in ZP/z-push from...

Merge pull request #67 in ZP/z-push from bugfix/ZP-726-infinit-loop-if-non-stream-given-for-an-attachment to develop

* commit 'ce1fe248':
  ZP-726 Infinit loop if non-stream is given for an attachment. Released under the Affero GNU General Public License (AGPL) version 3. need to check for a resource, as eg. feof("Error") === false and causing infinit loop in while!
parents d8979595 ce1fe248
...@@ -61,7 +61,8 @@ class GetAttachment extends RequestProcessor { ...@@ -61,7 +61,8 @@ class GetAttachment extends RequestProcessor {
$stream = $attachment->data; $stream = $attachment->data;
ZLog::Write(LOGLEVEL_DEBUG, sprintf("HandleGetAttachment(): attachment stream from backend: %s", $stream)); ZLog::Write(LOGLEVEL_DEBUG, sprintf("HandleGetAttachment(): attachment stream from backend: %s", $stream));
if ($stream == null) // need to check for a resource here, as eg. feof('Error') === false and causing infinit loop in while!
if (!is_resource($stream))
throw new StatusException(sprintf("HandleGetAttachment(): No stream resource returned by backend for attachment: %s", $attname), SYNC_ITEMOPERATIONSSTATUS_INVALIDATT); throw new StatusException(sprintf("HandleGetAttachment(): No stream resource returned by backend for attachment: %s", $attname), SYNC_ITEMOPERATIONSSTATUS_INVALIDATT);
header("Content-Type: application/octet-stream"); header("Content-Type: application/octet-stream");
......
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