diff --git a/lib/Controller/ApiController.php b/lib/Controller/ApiController.php index 2f534839..7b03e4b0 100644 --- a/lib/Controller/ApiController.php +++ b/lib/Controller/ApiController.php @@ -53,11 +53,13 @@ use OCP\Share\IShare; use Psr\Log\LoggerInterface; -function str_to_stream(string $string) { - $stream = fopen('php://memory', 'r+'); - fwrite($stream, $string); - rewind($stream); - return $stream; +if (!function_exists(__NAMESPACE__ . '\str_to_stream')) { + function str_to_stream(string $string) { + $stream = fopen('php://memory', 'r+'); + fwrite($stream, $string); + rewind($stream); + return $stream; + } } class ApiController extends OCSController { diff --git a/lib/Controller/DownloadController.php b/lib/Controller/DownloadController.php index 9e0cc575..f8936572 100644 --- a/lib/Controller/DownloadController.php +++ b/lib/Controller/DownloadController.php @@ -39,11 +39,13 @@ use OCP\IURLGenerator; use OCP\IUserSession; -function str_to_stream(string $string) { - $stream = fopen('php://memory', 'r+'); - fwrite($stream, $string); - rewind($stream); - return $stream; +if (!function_exists(__NAMESPACE__ . '\str_to_stream')) { + function str_to_stream(string $string) { + $stream = fopen('php://memory', 'r+'); + fwrite($stream, $string); + rewind($stream); + return $stream; + } } class DownloadController extends Controller {