[BUGFIX] use array_key_exists() to deal correctly with NULL values 81/42081/5
authorJo Hasenau <info@cybercraft.de>
Wed, 29 Jul 2015 08:15:08 +0000 (10:15 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Thu, 6 Aug 2015 12:20:30 +0000 (14:20 +0200)
Resolves: #68606
Releases: master
Change-Id: I22fbd200514324eca4a62b87d2a3018e87c8a85e
Reviewed-on: http://review.typo3.org/42081
Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Tomas Norre Mikkelsen <tomasnorre@gmail.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/core/Classes/DataHandling/DataHandler.php

index 9c7f4bf..5d6612a 100644 (file)
@@ -1635,7 +1635,8 @@ class DataHandler {
                if ((int)$id !== 0) {
                        // Get current value:
                        $curValueRec = $this->recordInfo($table, $id, $field);
-                       if (isset($curValueRec[$field])) {
+                       // isset() won't work here, since values can be NULL
+                       if (array_key_exists($field, $curValueRec)) {
                                $curValue = $curValueRec[$field];
                        }
                }
@@ -3396,12 +3397,14 @@ class DataHandler {
                                $conf = $GLOBALS['TCA'][$table]['columns'][$field]['config'];
                                // Preparation/Processing of the value:
                                // "pid" is hardcoded of course:
+                               // isset() won't work here, since values can be NULL in each of the arrays
+                               // except setDefaultOnCopyArray, since we exploded that from a string
                                if ($field == 'pid') {
                                        $value = $destPid;
-                               } elseif (isset($overrideValues[$field])) {
+                               } elseif (array_key_exists($field, $overrideValues)) {
                                        // Override value...
                                        $value = $overrideValues[$field];
-                               } elseif (isset($copyAfterFields[$field])) {
+                               } elseif (array_key_exists($field, $copyAfterFields)) {
                                        // Copy-after value if available:
                                        $value = $copyAfterFields[$field];
                                } elseif ($GLOBALS['TCA'][$table]['ctrl']['setToDefaultOnCopy'] && isset($setDefaultOnCopyArray[$field])) {