always return resource seeked to its start

This commit is contained in:
Ralf Becker 2015-04-14 17:05:38 +00:00
parent b08f90d930
commit 08609c1e0b
2 changed files with 3 additions and 2 deletions

View File

@ -2091,7 +2091,7 @@ class Vfs extends Vfs\StreamWrapper
if (is_resource($tmp_name)) if (is_resource($tmp_name))
{ {
$ret = ($dest = egw_vfs::fopen($target, 'w')) && $ret = ($dest = egw_vfs::fopen($target, 'w')) &&
stream_copy_to_stream($tmp_name, $dest) && stream_copy_to_stream($tmp_name, $dest) !== false &&
fclose($dest) && self::stat($target); fclose($dest) && self::stat($target);
fclose($tmp_name); fclose($tmp_name);

View File

@ -1596,6 +1596,8 @@ class egw_link extends solink
} }
$ret = call_user_func_array('ExecMethod2', $data); $ret = call_user_func_array('ExecMethod2', $data);
if (is_resource($ret)) fseek($ret, 0);
if ($return_resource != is_resource($ret)) if ($return_resource != is_resource($ret))
{ {
if ($return_resource && ($fp = fopen('php://temp', 'w'))) if ($return_resource && ($fp = fopen('php://temp', 'w')))
@ -1608,7 +1610,6 @@ class egw_link extends solink
{ {
$fp = $ret; $fp = $ret;
$ret = ''; $ret = '';
fseek($fp, 0);
while(!feof($fp)) while(!feof($fp))
{ {
$ret .= fread($fp, 8192); $ret .= fread($fp, 8192);