From 2ed2346a04bbd95894470f932da838215ac40ed6 Mon Sep 17 00:00:00 2001
From: Carsten  Rose <carsten.rose@math.uzh.ch>
Date: Sat, 27 Jan 2018 20:29:49 +0100
Subject: [PATCH] #5306 / Exception: tt_content_uid wrong - fixed

---
 extension/Documentation/Manual.rst                 | 6 ++++--
 extension/qfq/qfq/exceptions/AbstractException.php | 7 ++++++-
 extension/qfq/qfq/store/T3Info.php                 | 3 ++-
 3 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/extension/Documentation/Manual.rst b/extension/Documentation/Manual.rst
index 4296dc143..2d3a2c859 100644
--- a/extension/Documentation/Manual.rst
+++ b/extension/Documentation/Manual.rst
@@ -3190,7 +3190,7 @@ See also `downloadButton`_ to offer a download of an uploaded file.
 
     If `downloadButton` ist empty, just shows the regular download glyph.
 
-    Additional attributes might be given like `downloadButton='t:Download|o:check file`. Please check `download`_.
+    Additional attributes might be given like `downloadButton = t:Download|o:check file`. Please check `download`_.
 
   * fileSplit, fileDestinationSplit, tableNameSplit: see split-pdf-upload_
 
@@ -3224,7 +3224,9 @@ Requires: *'upload'-FormElement.name = 'column name'* of an column in the primar
 
 After moving the file to `fileDestination`, the current record/column will be updated to `fileDestination`.
 The database definition of the named column has to be a string variant (varchar, text but not numeric or else).
-On form load, the column value will be displayed as path/filename.
+On form load, the column value will be displayed,
+
+ * as the whole value (pathFileName)
 Deleting an uploaded file in the form (by clicking on the trash near beside) will delete
 the file on the filesystem as well. The column will be updated to an empty string.
 
diff --git a/extension/qfq/qfq/exceptions/AbstractException.php b/extension/qfq/qfq/exceptions/AbstractException.php
index 7bc3c7289..6d76a5054 100644
--- a/extension/qfq/qfq/exceptions/AbstractException.php
+++ b/extension/qfq/qfq/exceptions/AbstractException.php
@@ -26,17 +26,23 @@ class AbstractException extends \Exception {
      * @return string
      */
     public function formatException() {
+        $t3Vars = array();
 
         $debug = '';
         try {
             // In a very early stage, it might be possible that Store can't be initialized: take care not to use it.
             $store = Store::getInstance();
+            $t3Vars = $store->getStore(STORE_TYPO3);
         } catch (UserFormException $e) {
             $store = null;
         } catch (CodeException $e) {
             $store = null;
         }
 
+        if (empty($t3Vars)) {
+            $t3Vars = T3Info::getVars();
+        }
+
         $html = '';
 
         $this->messageArray['File'] = $this->getFile();
@@ -53,7 +59,6 @@ class AbstractException extends \Exception {
         $html .= "Code: " . htmlspecialchars($this->messageArray['Code']) . "<br>";
         $html .= "Message: " . Support::wrapTag("<strong>", htmlspecialchars($this->messageArray['Message'])) . "<br>";
 
-        $t3Vars = T3Info::getVars();
         $html .= 'Page Id: ' . $t3Vars[TYPO3_PAGE_ID] . '<br>';
         $html .= 'Content Id: ' . $t3Vars[TYPO3_TT_CONTENT_UID] . '<br>';
 
diff --git a/extension/qfq/qfq/store/T3Info.php b/extension/qfq/qfq/store/T3Info.php
index 438e0ff1c..a0702d29e 100644
--- a/extension/qfq/qfq/store/T3Info.php
+++ b/extension/qfq/qfq/store/T3Info.php
@@ -25,7 +25,8 @@ class T3Info {
 
         $t3vars[TYPO3_FE_USER_GROUP] = isset($GLOBALS["TSFE"]->fe_user->user["usergroup"]) ? $GLOBALS["TSFE"]->fe_user->user["usergroup"] : '';
 
-        $t3vars[TYPO3_TT_CONTENT_UID] = isset($GLOBALS["TSFE"]->page["uid"]) ? $GLOBALS["TSFE"]->page["uid"] : '';
+        // Will be set later
+        $t3vars[TYPO3_TT_CONTENT_UID] = 'no set yet';
 
         $t3vars[TYPO3_PAGE_ID] = isset($GLOBALS["TSFE"]->id) ? $GLOBALS["TSFE"]->id : '';
 
-- 
GitLab