[BUGFIX] Setting $checkStoredRecords leads to missing sys_log data 68/51568/5
authorThomas Hohn <thomas@hohn.dk>
Tue, 7 Feb 2017 20:59:11 +0000 (21:59 +0100)
committerMarkus Klein <markus.klein@typo3.org>
Mon, 20 Feb 2017 17:10:47 +0000 (18:10 +0100)
Setting the property $checkStoredRecords in DataHandler to false leads
to missing information in sys_log for new records since the
$newRecord array is empty.

This patch fills the $newRecord array with the newly inserted or
updated data - however the only thing that can't be retrieved is
the title since this is fetched through the call to
checkStoredRecord that is not executed.

Resolves: #79669
Releases: master
Change-Id: I2a53bc2880402fbb42fad859c9fef2dd7c5ae167
Reviewed-on: https://review.typo3.org/51568
Reviewed-by: Stephan GroƟberndt <stephan@grossberndt.de>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Claus Due <claus@phpmind.net>
Tested-by: Claus Due <claus@phpmind.net>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
typo3/sysext/core/Classes/DataHandling/DataHandler.php

index 7bcafb0..0e2a205 100644 (file)
@@ -6858,6 +6858,9 @@ class DataHandler
                         $newRow = [];
                         if ($this->checkStoredRecords) {
                             $newRow = $this->checkStoredRecord($table, $id, $fieldArray, 2);
+                        } else {
+                            $newRow = $fieldArray;
+                            $newRow['uid'] = $id;
                         }
                         // Set log entry:
                         $propArr = $this->getRecordPropertiesFromRow($table, $newRow);
@@ -6941,9 +6944,14 @@ class DataHandler
                         $this->substNEWwithIDs_table[$NEW_id] = $table;
                     }
                     $newRow = [];
-                    // Checking the record is properly saved and writing to log
-                    if ($this->enableLogging && $this->checkStoredRecords) {
-                        $newRow = $this->checkStoredRecord($table, $id, $fieldArray, 1);
+                    if ($this->enableLogging) {
+                        // Checking the record is properly saved if configured
+                        if ($this->checkStoredRecords) {
+                            $newRow = $this->checkStoredRecord($table, $id, $fieldArray, 1);
+                        } else {
+                            $newRow = $fieldArray;
+                            $newRow['uid'] = $id;
+                        }
                     }
                     // Update reference index:
                     $this->updateRefIndex($table, $id);