[BUGFIX] FAL: Prevent invalid NULL value on metadata creation 28/29028/7
authorMarkus Klein <klein.t3@mfc-linz.at>
Tue, 1 Apr 2014 14:11:40 +0000 (16:11 +0200)
committerMarkus Klein <klein.t3@mfc-linz.at>
Wed, 2 Apr 2014 10:18:26 +0000 (12:18 +0200)
The cruser_id field is now guaranteed to be an integer.
This patch checks if a BE_USER is available and uses zero
otherwise.

Resolves: #57495
Related: #46020
Releases: 6.2
Change-Id: I8260604eb30ca32d2a5e079fa6f5b10a6d04714e
Reviewed-on: https://review.typo3.org/29028
Reviewed-by: Nicole Cordes
Reviewed-by: Jigal van Hemert
Reviewed-by: Frans Saris
Reviewed-by: Stefan Neufeind
Tested-by: Stefan Neufeind
Reviewed-by: Alexander Opitz
Tested-by: Alexander Opitz
Reviewed-by: Markus Klein
Tested-by: Markus Klein
typo3/sysext/core/Classes/Resource/Index/MetaDataRepository.php
typo3/sysext/core/Classes/Resource/Service/IndexerService.php

index 52afc07..538389b 100644 (file)
@@ -115,7 +115,7 @@ class MetaDataRepository implements SingletonInterface {
                        'pid' => 0,
                        'crdate' => $GLOBALS['EXEC_TIME'],
                        'tstamp' => $GLOBALS['EXEC_TIME'],
-                       'cruser_id' => TYPO3_MODE == 'BE' ? $GLOBALS['BE_USER']->user['uid'] : 0
+                       'cruser_id' => isset($GLOBALS['BE_USER']->user['uid']) ? (int)$GLOBALS['BE_USER']->user['uid'] : 0
                );
                $emptyRecord = array_merge($emptyRecord, $additionalFields);
                $this->getDatabaseConnection()->exec_INSERTquery($this->tableName, $emptyRecord);
index 545602e..fb0f186 100644 (file)
@@ -136,7 +136,7 @@ class IndexerService implements \TYPO3\CMS\Core\SingletonInterface {
                                        'crdate' => $GLOBALS['EXEC_TIME'],
                                        'tstamp' => $GLOBALS['EXEC_TIME']
                                );
-                               if (TYPO3_MODE === 'BE') {
+                               if (isset($GLOBALS['BE_USER']->user['uid'])) {
                                        $additionalInfo['cruser_id'] = (int)$GLOBALS['BE_USER']->user['uid'];
                                }
                                $indexRecord = array_merge($fileInfo, $additionalInfo);