From cd297522cf19067fcc24aa9c07fc2e2566bb2b50 Mon Sep 17 00:00:00 2001
From: "florian.azizian" <florian.azizian@maarch.org>
Date: Mon, 8 Mar 2021 11:40:53 +0100
Subject: [PATCH] FIX #16205 TIME 0 debug

---
 src/app/document/controllers/DocumentController.php | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/app/document/controllers/DocumentController.php b/src/app/document/controllers/DocumentController.php
index 97769ab9c6..38fe2c277a 100755
--- a/src/app/document/controllers/DocumentController.php
+++ b/src/app/document/controllers/DocumentController.php
@@ -296,16 +296,22 @@ class DocumentController
         file_put_contents('debug.txt', date('Y-m-d H:i:s') . " - Body\n", FILE_APPEND);
 
         if (empty($body)) {
+            file_put_contents('debug.txt', date('Y-m-d H:i:s') . " - Empty body\n", FILE_APPEND);
             return $response->withStatus(400)->withJson(['errors' => 'Body is not set or empty']);
         } elseif (!Validator::notEmpty()->validate($body['encodedDocument'])) {
+            file_put_contents('debug.txt', date('Y-m-d H:i:s') . " - EncodedDocument\n", FILE_APPEND);
             return $response->withStatus(400)->withJson(['errors' => 'Body encodedDocument is empty']);
         } elseif (!Validator::stringType()->notEmpty()->validate($body['title'])) {
+            file_put_contents('debug.txt', date('Y-m-d H:i:s') . " - title\n", FILE_APPEND);
             return $response->withStatus(400)->withJson(['errors' => 'Body title is empty or not a string']);
         } elseif (!Validator::stringType()->notEmpty()->validate($body['sender'])) {
+            file_put_contents('debug.txt', date('Y-m-d H:i:s') . " - sender\n", FILE_APPEND);
             return $response->withStatus(400)->withJson(['errors' => 'Body sender is empty or not a string']);
         } elseif (!Validator::arrayType()->notEmpty()->validate($body['workflow'])) {
+            file_put_contents('debug.txt', date('Y-m-d H:i:s') . " - workflow\n", FILE_APPEND);
             return $response->withStatus(400)->withJson(['errors' => 'Body workflow is empty or not an array']);
         } elseif (!Validator::stringType()->length(0, 64)->validate($body['reference'])) {
+            file_put_contents('debug.txt', date('Y-m-d H:i:s') . " - reference\n", FILE_APPEND);
             return $response->withStatus(400)->withJson(['errors' => 'Body reference is too loong or not a string']);
         }
         file_put_contents('debug.txt', date('Y-m-d H:i:s') . " - Check Variables\n", FILE_APPEND);
-- 
GitLab