From bbbbb033f32353ef1582a6f90305c4ad01e2390a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Fri, 14 Mar 2014 18:20:33 +0100 Subject: [PATCH] in case of phpunit executions calling header() and exit() is too bad --- apps/files_encryption/lib/helper.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/apps/files_encryption/lib/helper.php b/apps/files_encryption/lib/helper.php index ef3775875f0..8cbbe8a45a6 100755 --- a/apps/files_encryption/lib/helper.php +++ b/apps/files_encryption/lib/helper.php @@ -367,9 +367,14 @@ class Helper { $post = 0; if(count($_POST) > 0) { $post = 1; - } - header('Location: ' . $location . '?p=' . $post . '&errorCode=' . $errorCode); - exit(); + } + + if(defined('PHPUNIT_RUN') and PHPUNIT_RUN) { + throw new \Exception("Encryption error: $errorCode"); + } + + header('Location: ' . $location . '?p=' . $post . '&errorCode=' . $errorCode); + exit(); } /**