[BUGFIX] RTE: array_flip warning on array of languages
authorStanislas Rolland <typo3@sjbr.ca>
Wed, 10 Oct 2012 18:30:44 +0000 (14:30 -0400)
committerStanislas Rolland <typo3@sjbr.ca>
Wed, 10 Oct 2012 18:38:05 +0000 (20:38 +0200)
Make sure the array is not corrupted.

Change-Id: I858731a55091ee5dffde33f995c3fef9044d041d
Resolves: #35147
Releases: 4.5, 4.6
Reviewed-on: http://review.typo3.org/15501
Reviewed-by: Stanislas Rolland
Tested-by: Stanislas Rolland
typo3/sysext/rtehtmlarea/extensions/Language/class.tx_rtehtmlarea_language.php

index 31eabc6..1ad4219 100644 (file)
@@ -137,12 +137,18 @@ class tx_rtehtmlarea_language extends tx_rtehtmlarea_api {
                                }
                        }
                        $GLOBALS['TYPO3_DB']->sql_free_result($res);
+                       $fromCharset = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['static_info_tables']['charset'];
+                       if (!$fromCharset) {
+                               $fromCharset = 'utf-8';
+                       }
                        if ($this->htmlAreaRTE->is_FE()) {
-                               $GLOBALS['TSFE']->csConvObj->convArray($nameArray, $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['static_info_tables']['charset'], $this->htmlAreaRTE->OutputCharset);
+                               $GLOBALS['TSFE']->csConvObj->convArray($nameArray, $fromCharset, $this->htmlAreaRTE->OutputCharset);
                        } else {
-                               $GLOBALS['LANG']->csConvObj->convArray($nameArray, $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['static_info_tables']['charset'], $GLOBALS['LANG']->charSet);
+                               $GLOBALS['LANG']->csConvObj->convArray($nameArray, $fromCharset, $GLOBALS['LANG']->charSet);
+                       }
+                       if (uasort($nameArray, 'strcoll') === FALSE) {
+                               $nameArray = array();
                        }
-                       uasort($nameArray, 'strcoll');
                }
                return $nameArray;
        }