From 7d181826732e1c69991d53109b190d72c89f2180 Mon Sep 17 00:00:00 2001
From: Oliver Hader <oliver@typo3.org>
Date: Sat, 28 Feb 2015 16:08:45 +0100
Subject: [PATCH] [BUGFIX] Invalid reference count on storing new child records
 in FlexForm

If creating a new parent record that contains inline child
records as part of a FlexForm configuration, the resulting
reference count is the temporary "NEW..." identifier. The
expected result is to have the number of child references
in that case as well.

Resolves: #58307
Releases: master, 6.2
Change-Id: I36a4dd06a38ad5d9f197190658b97f8a3b5fa234
Reviewed-on: http://review.typo3.org/37345
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
---
 typo3/sysext/core/Classes/DataHandling/DataHandler.php | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/typo3/sysext/core/Classes/DataHandling/DataHandler.php b/typo3/sysext/core/Classes/DataHandling/DataHandler.php
index b8f27511810a..7e7867d61086 100644
--- a/typo3/sysext/core/Classes/DataHandling/DataHandler.php
+++ b/typo3/sysext/core/Classes/DataHandling/DataHandler.php
@@ -5284,6 +5284,11 @@ class DataHandler {
 	 */
 	protected function updateFlexFormData($flexFormId, array $modifications) {
 		list ($table, $uid, $field) = explode(':', $flexFormId, 3);
+
+		if (!MathUtility::canBeInterpretedAsInteger($uid) && !empty($this->substNEWwithIDs[$uid])) {
+			$uid = $this->substNEWwithIDs[$uid];
+		}
+
 		$record = $this->recordInfo($table, $uid, '*');
 
 		if (!$table || !$uid || !$field || !is_array($record)) {
-- 
GitLab