[BUGFIX] Warnings in DataHandler on undefined array indexes 23/43423/2
authorOliver Hader <oliver@typo3.org>
Fri, 18 Sep 2015 14:07:52 +0000 (16:07 +0200)
committerOliver Hader <oliver.hader@typo3.org>
Fri, 18 Sep 2015 16:47:37 +0000 (18:47 +0200)
Accessing array indexes that actually do not exist, results
in a PHP warning. This behavior is caught by using isset()
or empty() on NULL values, but is not if using the function
array_key_exists(). Thus, an explicit check on NULL is added.

Resolves: #69948
Releases: master
Change-Id: I4fc9bb5ef9e8ff47ac199e0a7c02dd88ff6c1660
Reviewed-on: http://review.typo3.org/43423
Reviewed-by: Stephan GroƟberndt <stephan@grossberndt.de>
Reviewed-by: Oliver Hader <oliver.hader@typo3.org>
Tested-by: Oliver Hader <oliver.hader@typo3.org>
typo3/sysext/core/Classes/DataHandling/DataHandler.php

index 6ce96a6..9ee9e70 100644 (file)
@@ -1637,7 +1637,7 @@ class DataHandler {
                        // Get current value:
                        $curValueRec = $this->recordInfo($table, $id, $field);
                        // isset() won't work here, since values can be NULL
-                       if (array_key_exists($field, $curValueRec)) {
+                       if ($curValueRec !== NULL && array_key_exists($field, $curValueRec)) {
                                $curValue = $curValueRec[$field];
                        }
                }