diff --git a/tine20/Tinebase/Export/Report/Abstract.php b/tine20/Tinebase/Export/Report/Abstract.php index cd2dec4b049..d08fbae5990 100644 --- a/tine20/Tinebase/Export/Report/Abstract.php +++ b/tine20/Tinebase/Export/Report/Abstract.php @@ -120,7 +120,8 @@ protected function _saveToFilemanager($generatedExport) $tempFile = Tinebase_TempFile::getInstance()->createTempFile($exportFilename); $nodePath = Tinebase_Model_Tree_Node_Path::createFromRealPath($this->_fileLocation->fm_path, Tinebase_Application::getInstance()->getApplicationByName('Filemanager')); - Tinebase_FileSystem::getInstance()->copyTempfile($tempFile, $nodePath->statpath . '/' . $index . '_' . $filename); + $targetPath = $nodePath->statpath . '/' . $index . '_' . $filename; + Tinebase_FileSystem::getInstance()->copyTempfile($tempFile, $targetPath); } } diff --git a/tine20/Tinebase/FileSystem.php b/tine20/Tinebase/FileSystem.php index e262029bb21..054263025a2 100644 --- a/tine20/Tinebase/FileSystem.php +++ b/tine20/Tinebase/FileSystem.php @@ -2843,7 +2843,7 @@ public function clearDeletedFilesFromDatabase($dryRun = true) * @return Tinebase_Model_Tree_Node * @throws Tinebase_Exception_AccessDenied */ - public function copyTempfile($tempFile, $path, $deleteTempFileAfterCopy = false) + public function copyTempfile($tempFile, &$path, $deleteTempFileAfterCopy = false) { if ($tempFile === null) { $tempStream = fopen('php://memory', 'r'); @@ -2900,7 +2900,7 @@ public function setAclFromParent($path, $ifNotNull = false) * @throws Tinebase_Exception_AccessDenied * @throws Tinebase_Exception_UnexpectedValue */ - public function copyStream($in, $path) + public function copyStream($in, &$path) { $deleteFile = !$this->fileExists($path); try { @@ -2908,6 +2908,8 @@ public function copyStream($in, $path) throw new Tinebase_Exception_AccessDenied('Permission denied to create file (filename ' . $path . ')'); } + $path = stream_context_get_options($handle)['tine20']['path']; + if (!is_resource($in)) { throw new Tinebase_Exception_UnexpectedValue('source needs to be of type stream'); }