[BUGFIX] Properly check type of POST vars on clipboard action 00/36700/5
authorMarkus Klein <klein.t3@reelworx.at>
Thu, 5 Feb 2015 23:47:03 +0000 (00:47 +0100)
committerHelmut Hummel <helmut.hummel@typo3.org>
Fri, 6 Feb 2015 12:41:13 +0000 (13:41 +0100)
Avoid a PHP warning by checking the type of data retrieved via POST.

"CBC" is an array of checkboxes, which can be null if nothing is selected.
"CBH" is an array of hidden fields. If this is not an array, something
is messed up in HTML generation and an Exception should be thrown then
(because of a PHP warning).

Also adapt the list module code accordingly.

Resolves: #64897
Releases: master, 6.2
Change-Id: Ife7d079a6d666e8bdbbce7b7eef34dbf5636c425
Reviewed-on: http://review.typo3.org/36700
Reviewed-by: Helmut Hummel <helmut.hummel@typo3.org>
Tested-by: Helmut Hummel <helmut.hummel@typo3.org>
Reviewed-by: Markus Klein <klein.t3@reelworx.at>
Tested-by: Markus Klein <klein.t3@reelworx.at>

index 0586f61..6c14963 100644 (file)
@@ -282,7 +282,7 @@ class FileListController {
                        $CB = GeneralUtility::_GET('CB');
                        if ($this->cmd == 'setCB') {
-                               $CB['el'] = $this->filelist->clipObj->cleanUpCBC(array_merge(GeneralUtility::_POST('CBH'), GeneralUtility::_POST('CBC')), '_FILE');
+                               $CB['el'] = $this->filelist->clipObj->cleanUpCBC(array_merge(GeneralUtility::_POST('CBH'), (array)GeneralUtility::_POST('CBC')), '_FILE');
                        if (!$this->MOD_SETTINGS['clipBoard']) {
                                $CB['setP'] = 'normal';
index ee22feb..4478082 100644 (file)
@@ -329,7 +329,7 @@ class RecordList {
                        // CBH is all the fields selected for the clipboard, CBC is the checkbox fields which were checked.
                        // By merging we get a full array of checked/unchecked elements
                        // This is set to the 'el' array of the CB after being parsed so only the table in question is registered.
-                       $CB['el'] = $dblist->clipObj->cleanUpCBC(array_merge((array)GeneralUtility::_POST('CBH'), (array)GeneralUtility::_POST('CBC')), $this->cmd_table);
+                       $CB['el'] = $dblist->clipObj->cleanUpCBC(array_merge(GeneralUtility::_POST('CBH'), (array)GeneralUtility::_POST('CBC')), $this->cmd_table);
                if (!$this->MOD_SETTINGS['clipBoard']) {
                        // If the clipboard is NOT shown, set the pad to 'normal'.