Resolves #56389: Fatal error: Call to a member function getCollatingLocale() on a...
authorstan <stan@735d13b6-9817-0410-8766-e36946ffe9aa>
Mon, 17 Mar 2014 13:46:26 +0000 (13:46 +0000)
committerstan <stan@735d13b6-9817-0410-8766-e36946ffe9aa>
Mon, 17 Mar 2014 13:46:26 +0000 (13:46 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Extensions/static_info_tables/trunk@84321 735d13b6-9817-0410-8766-e36946ffe9aa

ChangeLog
Classes/Utility/LocalizationUtility.php

index da0d1fe..7adae4b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2014-03-17  Stanislas Rolland  <typo3@sjbr.ca>
+
+       * Resolves #56389: Fatal error: Call to a member function getCollatingLocale() on a non-object in LocalizationUtility.php
+
 2014-03-16  Stanislas Rolland  <typo3@sjbr.ca>
 
        * Resolves #56954: getIsoCodeField() is protected but needed from outside
index c1efd94..dc86ab4 100644 (file)
@@ -254,7 +254,7 @@ class LocalizationUtility {
                                }
                        }
                } else {
-                       self::$languageKey = strlen($GLOBALS['BE_USER']->uc['lang']) > 0 ? $GLOBALS['BE_USER']->uc['lang'] : 'EN';
+                       self::$languageKey = strlen($GLOBALS['BE_USER']->uc['lang']) > 0 ? $GLOBALS['BE_USER']->uc['lang'] : 'default';
                        // Get standard locale dependencies for the backend
                        /** @var $locales \TYPO3\CMS\Core\Localization\Locales */
                        $locales = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Localization\\Locales');
@@ -264,6 +264,9 @@ class LocalizationUtility {
                                }
                        }
                }
+               if (!self::$languageKey || self::$languageKey === 'default') {
+                       self::$languageKey = 'EN';
+               }
        }
        
        /**
@@ -281,8 +284,8 @@ class LocalizationUtility {
                        list($languageIsoCodeA2, $countryIsoCodeA2) = explode('_', $languageCode, 2);
                        /** @var $language SJBR\StaticInfoTables\Domain\Model\Language */
                        $language = $languageRepository->findOneByIsoCodes($languageIsoCodeA2, $countryIsoCodeA2 ? $countryIsoCodeA2 : '');
-                       // If $language is_a NULL, current language was not found in the Language repository. Most probably, the repository is empty.
-                       self::$collatingLocale = is_object($language) ? $language->getCollatingLocale() : 'en_GB';
+                       // If $language is NULL, current language was not found in the Language repository. Most probably, the repository is empty.
+                       self::$collatingLocale = ($language instanceof \SJBR\StaticInfoTables\Domain\Model\Language) ? $language->getCollatingLocale() : 'en_GB';
                }
                return setlocale(LC_COLLATE,
                        array(