[CLEANUP] Replace strlen() with === for zero length check 91/27091/10
authorMarkus Klein <klein.t3@mfc-linz.at>
Sun, 23 Feb 2014 10:21:20 +0000 (11:21 +0100)
committerStefan Neufeind <typo3.neufeind@speedpartner.de>
Sun, 23 Feb 2014 10:24:30 +0000 (11:24 +0100)
It is faster to compare a string with === '' to find out if it's empty
than to run strlen() on it.

The replacement rules are applied as follows:
 *    if (strlen($str))
   => if ((string)$str !== '')
 *    if (!is_string($str) || strlen($str) === 0)
   => if (!is_string($str) || $str === '')
 * If it can be seen easily that $str is a string,
   the typecast is omitted.

Resolves: #54091
Releases: 6.2
Change-Id: I59c5cbccea4f98b8f282377e6aa67d970859a457
Reviewed-on: https://review.typo3.org/27091
Reviewed-by: Stefan Neufeind
Tested-by: Stefan Neufeind
115 files changed:
typo3/sysext/backend/Classes/Configuration/TranslationConfigurationProvider.php
typo3/sysext/backend/Classes/Controller/EditDocumentController.php
typo3/sysext/backend/Classes/Controller/PageTreeNavigationController.php
typo3/sysext/backend/Classes/Controller/Wizard/FormsController.php
typo3/sysext/backend/Classes/Form/Element/SuggestDefaultReceiver.php
typo3/sysext/backend/Classes/Form/Element/TreeElement.php
typo3/sysext/backend/Classes/Form/FormEngine.php
typo3/sysext/backend/Classes/Tree/View/AbstractTreeView.php
typo3/sysext/backend/Classes/Utility/BackendUtility.php
typo3/sysext/backend/Classes/View/PageLayoutView.php
typo3/sysext/core/Classes/Authentication/BackendUserAuthentication.php
typo3/sysext/core/Classes/Cache/Backend/RedisBackend.php
typo3/sysext/core/Classes/Cache/Backend/Typo3DatabaseBackend.php
typo3/sysext/core/Classes/Charset/CharsetConverter.php
typo3/sysext/core/Classes/Configuration/TypoScript/ConditionMatching/AbstractConditionMatcher.php
typo3/sysext/core/Classes/Core/SystemEnvironmentBuilder.php
typo3/sysext/core/Classes/DataHandling/DataHandler.php
typo3/sysext/core/Classes/Database/QueryGenerator.php
typo3/sysext/core/Classes/Database/QueryView.php
typo3/sysext/core/Classes/Database/ReferenceIndex.php
typo3/sysext/core/Classes/Database/SoftReferenceIndex.php
typo3/sysext/core/Classes/Database/SqlParser.php
typo3/sysext/core/Classes/Error/DebugExceptionHandler.php
typo3/sysext/core/Classes/Error/ProductionExceptionHandler.php
typo3/sysext/core/Classes/Html/HtmlParser.php
typo3/sysext/core/Classes/Html/RteHtmlParser.php
typo3/sysext/core/Classes/Imaging/GraphicalFunctions.php
typo3/sysext/core/Classes/Mail/Rfc822AddressesParser.php
typo3/sysext/core/Classes/Mail/SwiftMailerAdapter.php
typo3/sysext/core/Classes/Page/PageRenderer.php
typo3/sysext/core/Classes/Resource/Filter/FileExtensionFilter.php
typo3/sysext/core/Classes/Resource/Service/UserFileInlineLabelService.php
typo3/sysext/core/Classes/TimeTracker/TimeTracker.php
typo3/sysext/core/Classes/TypoScript/Parser/TypoScriptParser.php
typo3/sysext/core/Classes/Utility/ExtensionManagementUtility.php
typo3/sysext/core/Classes/Utility/GeneralUtility.php
typo3/sysext/core/Classes/Utility/MailUtility.php
typo3/sysext/core/Classes/Utility/StringUtility.php
typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/MetaData/SystemConstraint.php
typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Utility/Files.php
typo3/sysext/cshmanual/Classes/Controller/HelpModuleController.php
typo3/sysext/dbal/Classes/Database/DatabaseConnection.php
typo3/sysext/dbal/Classes/Database/SqlParser.php
typo3/sysext/documentation/Classes/Service/DocumentationService.php
typo3/sysext/extbase/Classes/Configuration/BackendConfigurationManager.php
typo3/sysext/extbase/Classes/Configuration/FrontendConfigurationManager.php
typo3/sysext/extbase/Classes/Core/Bootstrap.php
typo3/sysext/extbase/Classes/Mvc/Controller/ActionController.php
typo3/sysext/extbase/Classes/Mvc/Controller/Argument.php
typo3/sysext/extbase/Classes/Mvc/Controller/CommandController.php
typo3/sysext/extbase/Classes/Mvc/Request.php
typo3/sysext/extbase/Classes/Mvc/Web/RequestBuilder.php
typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/DataMapFactory.php
typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/DataMapper.php
typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbBackend.php
typo3/sysext/extbase/Classes/Property/TypeConverter/DateTimeConverter.php
typo3/sysext/extbase/Classes/Property/TypeConverter/FloatConverter.php
typo3/sysext/extbase/Classes/Property/TypeConverter/IntegerConverter.php
typo3/sysext/extbase/Classes/Reflection/DocCommentParser.php
typo3/sysext/extbase/Classes/Scheduler/FieldProvider.php
typo3/sysext/extbase/Classes/Utility/ExtensionUtility.php
typo3/sysext/extbase/Classes/Utility/LocalizationUtility.php
typo3/sysext/extbase/Classes/Validation/ValidatorResolver.php
typo3/sysext/extbase/Tests/Unit/Property/TypeConverter/DateTimeConverterTest.php
typo3/sysext/extensionmanager/Classes/Utility/ConfigurationUtility.php
typo3/sysext/extensionmanager/Classes/Utility/EmConfUtility.php
typo3/sysext/extensionmanager/Classes/Utility/FileHandlingUtility.php
typo3/sysext/feedit/Classes/FrontendEditPanel.php
typo3/sysext/fluid/Classes/Core/Parser/TemplateParser.php
typo3/sysext/fluid/Classes/Core/Widget/AbstractWidgetController.php
typo3/sysext/fluid/Classes/ViewHelpers/Link/PageViewHelper.php
typo3/sysext/fluid/Classes/ViewHelpers/TranslateViewHelper.php
typo3/sysext/frontend/Classes/ContentObject/CaseContentObject.php
typo3/sysext/frontend/Classes/ContentObject/ContentContentObject.php
typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php
typo3/sysext/frontend/Classes/ContentObject/FormContentObject.php
typo3/sysext/frontend/Classes/ContentObject/ImageTextContentObject.php
typo3/sysext/frontend/Classes/ContentObject/Menu/AbstractMenuContentObject.php
typo3/sysext/frontend/Classes/ContentObject/Menu/GraphicalMenuContentObject.php
typo3/sysext/frontend/Classes/ContentObject/Menu/TextMenuContentObject.php
typo3/sysext/frontend/Classes/Controller/TranslationStatusController.php
typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php
typo3/sysext/frontend/Classes/Page/PageGenerator.php
typo3/sysext/frontend/Classes/View/AdminPanelView.php
typo3/sysext/indexed_search/Classes/Controller/SearchController.php
typo3/sysext/indexed_search/Classes/Controller/SearchFormController.php
typo3/sysext/indexed_search/Classes/FileContentParser.php
typo3/sysext/indexed_search/Classes/Indexer.php
typo3/sysext/install/Classes/Configuration/Image/AbstractImagePreset.php
typo3/sysext/install/Classes/Configuration/Image/ImageFeature.php
typo3/sysext/install/Classes/Controller/AbstractController.php
typo3/sysext/install/Classes/Controller/Action/Step/DatabaseConnect.php
typo3/sysext/install/Classes/Controller/Action/Step/DatabaseData.php
typo3/sysext/install/Classes/Controller/Action/Step/DatabaseSelect.php
typo3/sysext/install/Classes/Controller/Action/Tool/ImportantActions.php
typo3/sysext/install/Classes/Controller/StepController.php
typo3/sysext/install/Classes/FolderStructure/AbstractNode.php
typo3/sysext/install/Classes/FolderStructure/LinkNode.php
typo3/sysext/install/Classes/Service/SilentConfigurationUpgradeService.php
typo3/sysext/install/Classes/Service/SqlSchemaMigrationService.php
typo3/sysext/install/Classes/SystemEnvironment/Check.php
typo3/sysext/install/Classes/Updates/CompatVersionUpdate.php
typo3/sysext/lang/Classes/Utility/Connection/Ter.php
typo3/sysext/linkvalidator/Classes/LinkAnalyzer.php
typo3/sysext/lowlevel/Classes/Utility/ArrayBrowser.php
typo3/sysext/recordlist/Classes/Browser/ElementBrowser.php
typo3/sysext/recordlist/Classes/RecordList.php
typo3/sysext/recordlist/Classes/RecordList/DatabaseRecordList.php
typo3/sysext/recycler/Classes/Utility/RecyclerUtility.php
typo3/sysext/rtehtmlarea/Classes/Controller/SpellCheckingController.php
typo3/sysext/scheduler/Classes/CronCommand/NormalizeCommand.php
typo3/sysext/scheduler/Classes/Task/AbstractTask.php
typo3/sysext/setup/Classes/Controller/SetupModuleController.php
typo3/sysext/version/Classes/Hook/DataHandlerHook.php
typo3/sysext/workspaces/Classes/Controller/ReviewController.php

index 5eff0f8..63f92f4 100644 (file)
@@ -59,9 +59,13 @@ class TranslationConfigurationProvider {
                }
                $languageIconTitles[0] = array(
                        'uid' => 0,
-                       'title' => strlen($modSharedTSconfig['properties']['defaultLanguageLabel']) ? $modSharedTSconfig['properties']['defaultLanguageLabel'] . ' (' . $GLOBALS['LANG']->sl('LLL:EXT:lang/locallang_mod_web_list.xlf:defaultLanguage') . ')' : $GLOBALS['LANG']->sl('LLL:EXT:lang/locallang_mod_web_list.xlf:defaultLanguage'),
+                       'title' => $modSharedTSconfig['properties']['defaultLanguageLabel'] !== ''
+                                       ? $modSharedTSconfig['properties']['defaultLanguageLabel'] . ' (' . $GLOBALS['LANG']->sl('LLL:EXT:lang/locallang_mod_web_list.xlf:defaultLanguage') . ')'
+                                       : $GLOBALS['LANG']->sl('LLL:EXT:lang/locallang_mod_web_list.xlf:defaultLanguage'),
                        'ISOcode' => 'DEF',
-                       'flagIcon' => strlen($modSharedTSconfig['properties']['defaultLanguageFlag']) ? 'flags-' . $modSharedTSconfig['properties']['defaultLanguageFlag'] : 'empty-empty'
+                       'flagIcon' => $modSharedTSconfig['properties']['defaultLanguageFlag'] !== ''
+                                       ? 'flags-' . $modSharedTSconfig['properties']['defaultLanguageFlag']
+                                       : 'empty-empty'
                );
                // Set "All" language:
                $languageIconTitles[-1] = array(
@@ -80,7 +84,7 @@ class TranslationConfigurationProvider {
                                        $languageIconTitles[$row['uid']]['ISOcode'] = $staticLangRow['lg_iso_2'];
                                }
                        }
-                       if (strlen($row['flag'])) {
+                       if ($row['flag'] !== '') {
                                $languageIconTitles[$row['uid']]['flagIcon'] = IconUtility::mapRecordTypeToSpriteIconName('sys_language', $row);
                        }
                }
index 1927a27..ebf289b 100644 (file)
@@ -1249,7 +1249,9 @@ class EditDocumentController {
                                'uid' => 0,
                                'pid' => 0,
                                'hidden' => 0,
-                               'title' => strlen($modSharedTSconfig['properties']['defaultLanguageLabel']) ? $modSharedTSconfig['properties']['defaultLanguageLabel'] . ' (' . $GLOBALS['LANG']->sl('LLL:EXT:lang/locallang_mod_web_list.xlf:defaultLanguage') . ')' : $GLOBALS['LANG']->sl('LLL:EXT:lang/locallang_mod_web_list.xlf:defaultLanguage'),
+                               'title' => $modSharedTSconfig['properties']['defaultLanguageLabel'] !== ''
+                                               ? $modSharedTSconfig['properties']['defaultLanguageLabel'] . ' (' . $GLOBALS['LANG']->sl('LLL:EXT:lang/locallang_mod_web_list.xlf:defaultLanguage') . ')'
+                                               : $GLOBALS['LANG']->sl('LLL:EXT:lang/locallang_mod_web_list.xlf:defaultLanguage'),
                                'flag' => $modSharedTSconfig['properties']['defaultLanguageFlag']
                        )
                );
index 8c7d6ce..f691348 100644 (file)
@@ -305,7 +305,7 @@ class PageTreeNavigationController {
         */
        public function initializeTemporaryDBmount() {
                // Set/Cancel Temporary DB Mount:
-               if (strlen($this->setTempDBmount)) {
+               if ((string)$this->setTempDBmount !== '') {
                        $set = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->setTempDBmount, 0);
                        if ($set > 0 && $GLOBALS['BE_USER']->isInWebMount($set)) {
                                // Setting...:
index 8ad5b2b..ca24e7c 100644 (file)
@@ -463,7 +463,7 @@ class FormsController {
                                                case 'input':
 
                                                case 'password':
-                                                       if (strlen(trim($confData['specialEval']))) {
+                                                       if (trim($confData['specialEval']) !== '') {
                                                                $hiddenFields[] = '<input type="hidden" name="FORMCFG[c][' . ($k + 1) * 2 . '][specialEval]" value="' . htmlspecialchars($confData['specialEval']) . '" />';
                                                        }
                                                        break;
@@ -684,7 +684,7 @@ class FormsController {
                                                        if (trim($vv['extra'])) {
                                                                $tArr[2] = trim($vv['extra']);
                                                        }
-                                                       if (strlen($vv['specialEval'])) {
+                                                       if ($vv['specialEval'] !== '') {
                                                                // Preset blank default value so position 3 can get a value...
                                                                $thisLine[2] = '';
                                                                $thisLine[3] = $vv['specialEval'];
@@ -698,7 +698,7 @@ class FormsController {
                                                        if ((int)$vv['max']) {
                                                                $tArr[1] = (int)$vv['max'];
                                                        }
-                                                       if (strlen($vv['specialEval'])) {
+                                                       if ($vv['specialEval'] !== '') {
                                                                // Preset blank default value so position 3 can get a value...
                                                                $thisLine[2] = '';
                                                                $thisLine[3] = $vv['specialEval'];
index 631a41f..26e98cb 100644 (file)
@@ -218,7 +218,7 @@ class SuggestDefaultReceiver {
                $searchWholePhrase = $this->config['searchWholePhrase'];
                $searchString = $this->params['value'];
                $searchUid = (int)$searchString;
-               if (strlen($searchString)) {
+               if ($searchString !== '') {
                        $searchString = $GLOBALS['TYPO3_DB']->quoteStr($searchString, $this->table);
                        $likeCondition = ' LIKE \'' . ($searchWholePhrase ? '%' : '') . $GLOBALS['TYPO3_DB']->escapeStrForLike($searchString, $this->table) . '%\'';
                        // Search in all fields given by label or label_alt
@@ -244,7 +244,7 @@ class SuggestDefaultReceiver {
                        }
                }
                // add an additional search condition comment
-               if (isset($this->config['searchCondition']) && strlen($this->config['searchCondition']) > 0) {
+               if (isset($this->config['searchCondition']) && $this->config['searchCondition'] !== '') {
                        $this->selectClause .= ' AND ' . $this->config['searchCondition'];
                }
                // add the global clauses to the where-statement
index cba65d3..45293ab 100644 (file)
@@ -105,7 +105,7 @@ class TreeElement {
                                        $item->checked = in_array($additionalItem[1], $selectedNodes);
                                        if (file_exists(PATH_typo3 . $additionalItem[3])) {
                                                $item->icon = $additionalItem[3];
-                                       } elseif (strlen(trim($additionalItem[3]))) {
+                                       } elseif (trim($additionalItem[3]) !== '') {
                                                $item->iconCls = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconClasses($additionalItem[3]);
                                        }
                                        $itemArray[] = $item;
index dc72601..ce1d2d4 100644 (file)
@@ -2968,7 +2968,7 @@ TBE_EDITOR.customEvalFunctions[\'' . $evalData . '\'] = function(value) {
                                        $theTitle = $value['title'];
 
                                        // If there is a title, check for LLL label
-                                       if (strlen($theTitle) > 0) {
+                                       if ((string)$theTitle !== '') {
                                                $theTitle = htmlspecialchars(GeneralUtility::fixed_lgd_cs($this->sL($theTitle), 30));
                                        }
                                        // If it's a "section" or "container":
@@ -3134,7 +3134,7 @@ TBE_EDITOR.customEvalFunctions[\'' . $evalData . '\'] = function(value) {
                                                                        $alertMsgOnChange = '';
                                                                }
                                                                $fakePA['fieldChangeFunc'] = $PA['fieldChangeFunc'];
-                                                               if (strlen($alertMsgOnChange)) {
+                                                               if ($alertMsgOnChange !== '') {
                                                                        $fakePA['fieldChangeFunc']['alert'] = $alertMsgOnChange;
                                                                }
                                                                $fakePA['onFocus'] = $PA['onFocus'];
index c415326..f1ea8dc 100644 (file)
@@ -697,14 +697,14 @@ abstract class AbstractTreeView {
         * @todo Define visibility
         */
        public function getTitleStr($row, $titleLen = 30) {
-               if ($this->ext_showNavTitle && strlen(trim($row['nav_title'])) > 0) {
+               if ($this->ext_showNavTitle && trim($row['nav_title']) !== '') {
                        $title = '<span title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_tca.xlf:title', TRUE) . ' ' . htmlspecialchars(trim($row['title'])) . '">' . htmlspecialchars(GeneralUtility::fixed_lgd_cs($row['nav_title'], $titleLen)) . '</span>';
                } else {
                        $title = htmlspecialchars(GeneralUtility::fixed_lgd_cs($row['title'], $titleLen));
-                       if (strlen(trim($row['nav_title'])) > 0) {
+                       if (trim($row['nav_title']) !== '') {
                                $title = '<span title="' . $GLOBALS['LANG']->sL('LLL:EXT:cms/locallang_tca.xlf:pages.nav_title', TRUE) . ' ' . htmlspecialchars(trim($row['nav_title'])) . '">' . $title . '</span>';
                        }
-                       $title = strlen(trim($row['title'])) == 0 ? '<em>[' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.no_title', TRUE) . ']</em>' : $title;
+                       $title = trim($row['title']) === '' ? '<em>[' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.no_title', TRUE) . ']</em>' : $title;
                }
                return $title;
        }
index 79e2748..d903ddf 100644 (file)
@@ -2607,10 +2607,10 @@ class BackendUtility {
                // Look if a fixed preview language should be added:
                $viewLanguageOrder = $GLOBALS['BE_USER']->getTSConfigVal('options.view.languageOrder');
 
-               if (strlen($viewLanguageOrder) > 0) {
+               if ((string)$viewLanguageOrder !== '') {
                        $suffix = '';
                        // Find allowed languages (if none, all are allowed!)
-                       if (!$GLOBALS['BE_USER']->user['admin'] && strlen($GLOBALS['BE_USER']->groupData['allowed_languages'])) {
+                       if (!$GLOBALS['BE_USER']->user['admin'] && $GLOBALS['BE_USER']->groupData['allowed_languages'] !== '') {
                                $allowedLanguages = array_flip(explode(',', $GLOBALS['BE_USER']->groupData['allowed_languages']));
                        }
                        // Traverse the view order, match first occurence:
@@ -3499,7 +3499,7 @@ class BackendUtility {
                        $parserList = implode(',', array_keys($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['softRefParser_GL'])) . ',' . $parserList;
                }
                // Return immediately if list is blank:
-               if (!strlen($parserList)) {
+               if ($parserList === '') {
                        return FALSE;
                }
                // Otherwise parse the list:
index 918af6d..82687e9 100644 (file)
@@ -566,7 +566,7 @@ class PageLayoutView extends \TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRe
                                                                $grid .= $head[$columnKey] . $content[$columnKey];
                                                        } elseif (isset($columnConfig['colPos']) && $columnConfig['colPos'] !== '') {
                                                                $grid .= $this->tt_content_drawColHeader($GLOBALS['LANG']->getLL('noAccess'), '', '');
-                                                       } elseif (isset($columnConfig['name']) && strlen($columnConfig['name']) > 0) {
+                                                       } elseif (isset($columnConfig['name']) && $columnConfig['name'] !== '') {
                                                                $grid .= $this->tt_content_drawColHeader($GLOBALS['LANG']->sL($columnConfig['name']) . ' (' . $GLOBALS['LANG']->getLL('notAssigned') . ')', '', '');
                                                        } else {
                                                                $grid .= $this->tt_content_drawColHeader($GLOBALS['LANG']->getLL('notAssigned'), '', '');
@@ -1543,7 +1543,7 @@ class PageLayoutView extends \TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRe
                                unset($langSelItems[$row['uid']]);
                        }
                        // Remove disallowed languages
-                       if (count($langSelItems) > 1 && !$GLOBALS['BE_USER']->user['admin'] && strlen($GLOBALS['BE_USER']->groupData['allowed_languages'])) {
+                       if (count($langSelItems) > 1 && !$GLOBALS['BE_USER']->user['admin'] && $GLOBALS['BE_USER']->groupData['allowed_languages'] !== '') {
                                $allowed_languages = array_flip(explode(',', $GLOBALS['BE_USER']->groupData['allowed_languages']));
                                if (count($allowed_languages)) {
                                        foreach ($langSelItems as $key => $value) {
index 640765f..8bed5a8 100644 (file)
@@ -1138,8 +1138,8 @@ class BackendUserAuthentication extends \TYPO3\CMS\Core\Authentication\AbstractU
                $TSConf = array('value' => NULL, 'properties' => NULL);
                $parts = GeneralUtility::trimExplode('.', $objectString, TRUE, 2);
                $key = $parts[0];
-               if (strlen($key) > 0) {
-                       if (count($parts) > 1 && strlen($parts[1]) > 0) {
+               if ($key !== '') {
+                       if (count($parts) > 1 && $parts[1] !== '') {
                                // Go on, get the next level
                                if (is_array($config[$key . '.'])) {
                                        $TSConf = $this->getTSConfig($parts[1], $config[$key . '.']);
index 0df979f..1d1e850 100644 (file)
@@ -152,7 +152,7 @@ class RedisBackend extends \TYPO3\CMS\Core\Cache\Backend\AbstractBackend impleme
                        \TYPO3\CMS\Core\Utility\GeneralUtility::sysLog('Could not connect to redis server.', 'core', \TYPO3\CMS\Core\Utility\GeneralUtility::SYSLOG_SEVERITY_ERROR);
                }
                if ($this->connected) {
-                       if (strlen($this->password)) {
+                       if ($this->password !== '') {
                                $success = $this->redis->auth($this->password);
                                if (!$success) {
                                        throw new \TYPO3\CMS\Core\Cache\Exception('The given password was not accepted by the redis server.', 1279765134);
@@ -329,7 +329,7 @@ class RedisBackend extends \TYPO3\CMS\Core\Cache\Backend\AbstractBackend impleme
                if ($this->connected) {
                        $storedEntry = $this->redis->get(self::IDENTIFIER_DATA_PREFIX . $entryIdentifier);
                }
-               if ($this->compression && strlen($storedEntry) > 0) {
+               if ($this->compression && (string)$storedEntry !== '') {
                        $storedEntry = gzuncompress($storedEntry);
                }
                return $storedEntry;
index 0be3b75..83d501d 100644 (file)
@@ -187,7 +187,7 @@ class Typo3DatabaseBackend extends \TYPO3\CMS\Core\Cache\Backend\AbstractBackend
                if (is_array($cacheEntry)) {
                        $cacheEntry = $cacheEntry['content'];
                }
-               if ($this->compression && strlen($cacheEntry)) {
+               if ($this->compression && (string)$cacheEntry !== '') {
                        $cacheEntry = gzuncompress($cacheEntry);
                }
                return $cacheEntry !== NULL ? $cacheEntry : FALSE;
index c638c08..cde2dab 100644 (file)
@@ -1688,11 +1688,11 @@ class CharsetConverter {
                        return $string;
                } else {
                        if ($len > 0) {
-                               if (strlen($string[$i])) {
+                               if (isset($string[$i])) {
                                        return substr($string, 0, $i) . $crop;
                                }
                        } else {
-                               if (strlen($string[$i - 1])) {
+                               if (isset($string[$i - 1])) {
                                        return $crop . substr($string, $i);
                                }
                        }
@@ -1890,7 +1890,7 @@ class CharsetConverter {
                                return $str;
                }
                $out = '';
-               for ($i = 0; strlen($str[$i]); $i++) {
+               for ($i = 0; isset($str[$i]); $i++) {
                        $c = $str[$i];
                        if (isset($map[$c])) {
                                $out .= $map[$c];
@@ -1956,7 +1956,7 @@ class CharsetConverter {
         */
        public function utf8_strlen($str) {
                $n = 0;
-               for ($i = 0; strlen($str[$i]); $i++) {
+               for ($i = 0; isset($str[$i]); $i++) {
                        $c = ord($str[$i]);
                        // Single-byte (0xxxxxx)
                        if (!($c & 128)) {
@@ -2073,7 +2073,7 @@ class CharsetConverter {
                        $i = strlen($str) - 1;
                        $d = -1;
                }
-               for (; strlen($str[$i]) && $n < $p; $i += $d) {
+               for (; isset($str[$i]) && $n < $p; $i += $d) {
                        $c = (int)ord($str[$i]);
                        // single-byte (0xxxxxx)
                        if (!($c & 128)) {
@@ -2083,7 +2083,7 @@ class CharsetConverter {
                                $n++;
                        }
                }
-               if (!strlen($str[$i])) {
+               if (!isset($str[$i])) {
                        // Offset beyond string length
                        return FALSE;
                }
@@ -2121,7 +2121,7 @@ class CharsetConverter {
                                $n++;
                        }
                }
-               if (!strlen($str[$i])) {
+               if (!isset($str[$i])) {
                        // Offset beyond string length
                        return FALSE;
                }
@@ -2153,7 +2153,7 @@ class CharsetConverter {
                        default:
                                return $str;
                }
-               for ($i = 0; strlen($str[$i]); $i++) {
+               for ($i = 0; isset($str[$i]); $i++) {
                        $c = ord($str[$i]);
                        // single-byte (0xxxxxx)
                        if (!($c & 128)) {
@@ -2199,7 +2199,7 @@ class CharsetConverter {
         */
        public function euc_strtrunc($str, $len, $charset) {
                $sjis = $charset == 'shift_jis';
-               for ($i = 0; strlen($str[$i]) && $i < $len; $i++) {
+               for ($i = 0; isset($str[$i]) && $i < $len; $i++) {
                        $c = ord($str[$i]);
                        if ($sjis) {
                                if ($c >= 128 && $c < 160 || $c >= 224) {
@@ -2211,7 +2211,7 @@ class CharsetConverter {
                                }
                        }
                }
-               if (!strlen($str[$i])) {
+               if (!isset($str[$i])) {
                        return $str;
                }
                // string shorter than supplied length
@@ -2265,7 +2265,7 @@ class CharsetConverter {
        public function euc_strlen($str, $charset) {
                $sjis = $charset == 'shift_jis';
                $n = 0;
-               for ($i = 0; strlen($str[$i]); $i++) {
+               for ($i = 0; isset($str[$i]); $i++) {
                        $c = ord($str[$i]);
                        if ($sjis) {
                                if ($c >= 128 && $c < 160 || $c >= 224) {
@@ -2303,7 +2303,7 @@ class CharsetConverter {
                        $i = strlen($str) - 1;
                        $d = -1;
                }
-               for (; strlen($str[$i]) && $n < $p; $i += $d) {
+               for (; isset($str[$i]) && $n < $p; $i += $d) {
                        $c = ord($str[$i]);
                        if ($sjis) {
                                if ($c >= 128 && $c < 160 || $c >= 224) {
@@ -2316,7 +2316,7 @@ class CharsetConverter {
                        }
                        $n++;
                }
-               if (!strlen($str[$i])) {
+               if (!isset($str[$i])) {
                        return FALSE;
                }
                // offset beyond string length
@@ -2358,7 +2358,7 @@ class CharsetConverter {
                }
                $sjis = $charset == 'shift_jis';
                $out = '';
-               for ($i = 0; strlen($str[$i]); $i++) {
+               for ($i = 0; isset($str[$i]); $i++) {
                        $mbc = $str[$i];
                        $c = ord($mbc);
                        if ($sjis) {
index 0fb0697..350d5af 100644 (file)
@@ -287,7 +287,7 @@ abstract class AbstractConditionMatcher {
                                break;
                        case 'useragent':
                                $test = trim($value);
-                               if (strlen($test)) {
+                               if ($test !== '') {
                                        return $this->searchStringWildcard($browserInfo['useragent'], $test);
                                }
                                break;
index ea6b0c4..c34f2db 100644 (file)
@@ -466,7 +466,7 @@ class SystemEnvironmentBuilder {
         */
        static protected function getPathSiteByRelativePathPart($relativePathPart) {
                $entryScriptDirectory = self::getUnifiedDirectoryNameWithTrailingSlash(PATH_thisScript);
-               if (strlen($relativePathPart) > 0) {
+               if ($relativePathPart !== '') {
                        $pathSite = substr($entryScriptDirectory, 0, -strlen($relativePathPart));
                } else {
                        $pathSite = $entryScriptDirectory;
index f64d834..fb8bab7 100644 (file)
@@ -2390,7 +2390,7 @@ class DataHandler {
                        }
                        $GLOBALS['TYPO3_DB']->sql_free_result($res);
                        // If the new value is there:
-                       $value = strlen($newValue) ? $newValue : $value;
+                       $value = $newValue !== '' ? $newValue : $value;
                }
                return $value;
        }
@@ -3443,7 +3443,7 @@ class DataHandler {
                // Process references and files, currently that means only the files, prepending absolute paths:
                $dataValue = $this->copyRecord_procFilesRefs($dsConf, $uid, $dataValue);
                // If references are set for this field, set flag so they can be corrected later (in ->remapListedDBRecords())
-               if ($this->isReferenceField($dsConf) && strlen($dataValue)) {
+               if ($this->isReferenceField($dsConf) && (string)$dataValue !== '') {
                        $dataValue = $this->copyRecord_procBasedOnFieldType($table, $uid, $field, $dataValue, array(), $dsConf, $realDestPid);
                        $this->registerDBList[$table][$uid][$field] = 'FlexForm_reference';
                }
@@ -3996,14 +3996,13 @@ class DataHandler {
                                                                                foreach ($GLOBALS['TCA'][$Ttable]['columns'] as $fN => $fCfg) {
                                                                                        // Check if we are just prefixing:
                                                                                        if ($fCfg['l10n_mode'] == 'prefixLangTitle') {
-                                                                                               if (($fCfg['config']['type'] == 'text' || $fCfg['config']['type'] == 'input') && strlen($row[$fN])) {
+                                                                                               if (($fCfg['config']['type'] == 'text' || $fCfg['config']['type'] == 'input') && (string)$row[$fN] !== '') {
                                                                                                        list($tscPID) = BackendUtility::getTSCpid($table, $uid, '');
                                                                                                        $TSConfig = $this->getTCEMAIN_TSconfig($tscPID);
-                                                                                                       if (isset($TSConfig['translateToMessage']) && strlen($TSConfig['translateToMessage'])) {
-                                                                                                               $translateToMsg = @sprintf($TSConfig['translateToMessage'], $langRec['title']);
-                                                                                                       }
-                                                                                                       if (!strlen($translateToMsg)) {
+                                                                                                       if (empty($TSConfig['translateToMessage'])) {
                                                                                                                $translateToMsg = 'Translate to ' . $langRec['title'] . ':';
+                                                                                                       } else {
+                                                                                                               $translateToMsg = @sprintf($TSConfig['translateToMessage'], $langRec['title']);
                                                                                                        }
                                                                                                        $overrideValues[$fN] = '[' . $translateToMsg . '] ' . $row[$fN];
                                                                                                }
@@ -4987,7 +4986,7 @@ class DataHandler {
                // Extract parameters:
                list($table, $uid, $field) = $pParams;
                // If references are set for this field, set flag so they can be corrected later:
-               if ($this->isReferenceField($dsConf) && strlen($dataValue)) {
+               if ($this->isReferenceField($dsConf) && (string)$dataValue !== '') {
                        $vArray = $this->remapListedDBRecords_procDBRefs($dsConf, $dataValue, $uid, $table);
                        if (is_array($vArray)) {
                                $dataValue = implode(',', $vArray);
index e754ae8..3add962 100644 (file)
@@ -837,7 +837,7 @@ class QueryGenerator {
                                                                }
                                                        } else {
                                                                $singleValue = $row[$fN];
-                                                               if (strlen($singleValue) && !stristr($singleValue, '_')) {
+                                                               if ($singleValue !== '' && !stristr($singleValue, '_')) {
                                                                        $dontPrefixFirstTable = 1;
                                                                }
                                                        }
index b560381..cd4e719 100644 (file)
@@ -841,7 +841,7 @@ class QueryView {
                                                                }
                                                        } else {
                                                                $singleValue = $row[$fN];
-                                                               if (strlen($singleValue) && !stristr($singleValue, '_')) {
+                                                               if ($singleValue !== '' && !stristr($singleValue, '_')) {
                                                                        $dontPrefixFirstTable = 1;
                                                                }
                                                        }
index 887d895..52ddf39 100644 (file)
@@ -391,7 +391,7 @@ class ReferenceIndex {
                                        }
                                }
                                // Soft References:
-                               if (strlen($value) && ($softRefs = BackendUtility::explodeSoftRefParserList($conf['softref']))) {
+                               if ((string)$value !== '' && ($softRefs = BackendUtility::explodeSoftRefParserList($conf['softref']))) {
                                        $softRefValue = $value;
                                        foreach ($softRefs as $spKey => $spParams) {
                                                $softRefObj = BackendUtility::softRefParserObj($spKey);
@@ -399,7 +399,7 @@ class ReferenceIndex {
                                                        $resultArray = $softRefObj->findRef($table, $field, $uid, $softRefValue, $spKey, $spParams);
                                                        if (is_array($resultArray)) {
                                                                $outRow[$field]['softrefs']['keys'][$spKey] = $resultArray['elements'];
-                                                               if (strlen($resultArray['content'])) {
+                                                               if ((string)$resultArray['content'] !== '') {
                                                                        $softRefValue = $resultArray['content'];
                                                                }
                                                        }
@@ -443,7 +443,7 @@ class ReferenceIndex {
                        $this->temp_flexRelations['db'][$structurePath] = $result;
                }
                // Soft References:
-               if (strlen($dataValue) && ($softRefs = BackendUtility::explodeSoftRefParserList($dsConf['softref']))) {
+               if ((string)$dataValue !== '' && ($softRefs = BackendUtility::explodeSoftRefParserList($dsConf['softref']))) {
                        $softRefValue = $dataValue;
                        foreach ($softRefs as $spKey => $spParams) {
                                $softRefObj = BackendUtility::softRefParserObj($spKey);
@@ -451,7 +451,7 @@ class ReferenceIndex {
                                        $resultArray = $softRefObj->findRef($table, $field, $uid, $softRefValue, $spKey, $spParams, $structurePath);
                                        if (is_array($resultArray) && is_array($resultArray['elements'])) {
                                                $this->temp_flexRelations['softrefs'][$structurePath]['keys'][$spKey] = $resultArray['elements'];
-                                               if (strlen($resultArray['content'])) {
+                                               if ((string)$resultArray['content'] !== '') {
                                                        $softRefValue = $resultArray['content'];
                                                }
                                        }
index 66942e0..76d387d 100644 (file)
@@ -570,10 +570,10 @@ class SoftReferenceIndex {
                $finalTagParts = array();
                // Split by space into link / target / class
                list($link_param, $browserTarget, $cssClass) = GeneralUtility::trimExplode(' ', $typolinkValue, TRUE);
-               if (strlen($browserTarget)) {
+               if ($browserTarget !== '') {
                        $finalTagParts['target'] = $browserTarget;
                }
-               if (strlen($cssClass)) {
+               if ($cssClass !== '') {
                        $finalTagParts['class'] = $cssClass;
                }
                // Parse URL:
@@ -624,8 +624,9 @@ class SoftReferenceIndex {
                                        // Link-data del
                                        $link_param = trim($link_params_parts[0]);
 
-                                       if (strlen($link_params_parts[1])) {
-                                               $finalTagParts['anchor'] = trim($link_params_parts[1]);
+                                       $linkAnchor = isset($link_params_parts[1]) ? trim($link_params_parts[1]) : '';
+                                       if ($linkAnchor !== '')  {
+                                               $finalTagParts['anchor'] = $linkAnchor;
                                        }
 
                                        // Splitting the parameter by ',' and if the array counts more than 1 element it's a id/type/? pair
@@ -636,7 +637,7 @@ class SoftReferenceIndex {
                                        }
 
                                        // Checking if the id-parameter is an alias.
-                                       if (strlen($link_param)) {
+                                       if ((string)$link_param !== '') {
                                                if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($link_param)) {
                                                        $finalTagParts['alias'] = $link_param;
                                                        $link_param = $this->getPageIdFromAlias($link_param);
@@ -739,11 +740,11 @@ class SoftReferenceIndex {
                                        );
                                }
                                // Add type if applicable
-                               if (strlen($tLP['type'])) {
+                               if ((string)$tLP['type'] !== '') {
                                        $content .= ',' . $tLP['type'];
                                }
                                // Add anchor if applicable
-                               if (strlen($tLP['anchor'])) {
+                               if ((string)$tLP['anchor'] !== '') {
                                        // Anchor is assumed to point to a content elements:
                                        if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($tLP['anchor'])) {
                                                // Initialize a new entry because we have a new relation:
@@ -768,9 +769,9 @@ class SoftReferenceIndex {
                                return $content;
                }
                // Finally, for all entries that was rebuild with tokens, add target and class in the end:
-               if (strlen($content) && strlen($tLP['target'])) {
+               if ($content !== '' && $tLP['target'] !== '') {
                        $content .= ' ' . $tLP['target'];
-                       if (strlen($tLP['class'])) {
+                       if ($tLP['class'] !== '') {
                                $content .= ' ' . $tLP['class'];
                        }
                }
index 30faae4..ea5c317 100644 (file)
@@ -406,7 +406,7 @@ class SqlParser {
                $result['TABLE'] = $this->nextPart($parseString, '^([[:alnum:]_]+)[[:space:]]*\\(', TRUE);
                if ($result['TABLE']) {
                        // While the parseString is not yet empty:
-                       while (strlen($parseString) > 0) {
+                       while ($parseString !== '') {
                                // Getting key
                                if ($key = $this->nextPart($parseString, '^(KEY|PRIMARY KEY|UNIQUE KEY|UNIQUE)([[:space:]]+|\\()')) {
                                        $key = strtoupper(str_replace(array(' ', TAB, CR, LF), '', $key));
@@ -661,7 +661,7 @@ class SqlParser {
        public function parseFieldList(&$parseString, $stopRegex = '') {
                $stack = array();
                // Contains the parsed content
-               if (strlen($parseString) == 0) {
+               if ($parseString === '') {
                        return $stack;
                }
                // FIXME - should never happen, why does it?
@@ -678,7 +678,7 @@ class SqlParser {
                // Parse any SQL hint / comments
                $stack[$pnt]['comments'] = $this->nextPart($parseString, '^(\\/\\*.*\\*\\/)');
                // $parseString is continuously shortened by the process and we keep parsing it till it is zero:
-               while (strlen($parseString)) {
+               while ($parseString !== '') {
                        // Checking if we are inside / outside parenthesis (in case of a function like count(), max(), min() etc...):
                        // Inside parenthesis here (does NOT detect if values in quotes are used, the only token is ")" or "("):
                        if ($level > 0) {
@@ -762,7 +762,7 @@ class SqlParser {
                                        return $stack;
                                }
                                // Looking for comma (since the stop-keyword did not trigger a return...)
-                               if (strlen($parseString) && !$this->nextPart($parseString, '^(,)')) {
+                               if ($parseString !== '' && !$this->nextPart($parseString, '^(,)')) {
                                        return $this->parseError('No comma found as expected in parseFieldList()', $parseString);
                                }
                                // Increasing pointer:
@@ -834,7 +834,7 @@ class SqlParser {
                // Recursivity brake.
                $loopExit = 0;
                // $parseString is continously shortend by the process and we keep parsing it till it is zero:
-               while (strlen($parseString)) {
+               while ($parseString !== '') {
                        // Looking for the table:
                        if ($stack[$pnt]['table'] = $this->nextPart($parseString, '^([[:alnum:]_]+)(,|[[:space:]]+)')) {
                                // Looking for stop-keywords before fetching potential table alias:
@@ -913,7 +913,7 @@ class SqlParser {
                                return $stack;
                        }
                        // Looking for comma:
-                       if (strlen($parseString) && !$this->nextPart($parseString, '^(,)')) {
+                       if ($parseString !== '' && !$this->nextPart($parseString, '^(,)')) {
                                return $this->parseError('No comma found as expected in parseFromTables()', $parseString);
                        }
                        // Increasing pointer:
@@ -951,7 +951,7 @@ class SqlParser {
                // Recursivity brake.
                $loopExit = 0;
                // $parseString is continously shortend by the process and we keep parsing it till it is zero:
-               while (strlen($parseString)) {
+               while ($parseString !== '') {
                        // Look for next parenthesis level:
                        $newLevel = $this->nextPart($parseString, '^([(])');
                        // If new level is started, manage stack/pointers:
@@ -1080,7 +1080,7 @@ class SqlParser {
                                                }
                                                // See if the value is calculated:
                                                $stack[$level][$pnt[$level]]['calc'] = $this->nextPart($parseString, '^(' . $calcOperators . ')');
-                                               if (strlen($stack[$level][$pnt[$level]]['calc'])) {
+                                               if ((string)$stack[$level][$pnt[$level]]['calc'] !== '') {
                                                        // Finding value for calculation:
                                                        $calc_value = $this->getValue($parseString);
                                                        $stack[$level][$pnt[$level]]['calc_value'] = $calc_value;
@@ -1118,7 +1118,7 @@ class SqlParser {
                                                'NOT[[:space]]+BETWEEN'
                                        );
                                        $stack[$level][$pnt[$level]]['comparator'] = $this->nextPart($parseString, '^(' . implode('|', $comparatorPatterns) . ')');
-                                       if (strlen($stack[$level][$pnt[$level]]['comparator'])) {
+                                       if ($stack[$level][$pnt[$level]]['comparator'] !== '') {
                                                if (preg_match('/^CONCAT[[:space:]]*\\(/', $parseString)) {
                                                        $this->nextPart($parseString, '^(CONCAT[[:space:]]?[(])');
                                                        $values = array(
@@ -1206,7 +1206,7 @@ class SqlParser {
                                        // Normalize boolean operator
                                        $op = str_replace(array('&&', '||'), array('AND', 'OR'), $op);
                                        $stack[$level][$pnt[$level]]['operator'] = $op;
-                               } elseif (strlen($parseString)) {
+                               } elseif ($parseString !== '') {
                                        // Looking for stop-keywords:
                                        if ($stopRegex && ($this->lastStopKeyWord = $this->nextPart($parseString, $stopRegex))) {
                                                $this->lastStopKeyWord = strtoupper(str_replace(array(' ', TAB, CR, LF), '', $this->lastStopKeyWord));
@@ -1403,7 +1403,7 @@ class SqlParser {
                        $buffer .= $v;
                        $reg = array();
                        preg_match('/\\\\$/', $v, $reg);
-                       if ($reg and strlen($reg[0]) % 2) {
+                       if ($reg && strlen($reg[0]) % 2) {
                                $buffer .= $quote;
                        } else {
                                $parseString = ltrim(substr($parseString, strlen($buffer) + 2));
@@ -1526,10 +1526,10 @@ class SqlParser {
                // Make query:
                $query = 'SELECT ' . ($components['STRAIGHT_JOIN'] ?: '') . '
                                ' . $this->compileFieldList($components['SELECT']) . '
-                               FROM ' . $this->compileFromTables($components['FROM']) . (strlen($where) ? '
-                               WHERE ' . $where : '') . (strlen($groupBy) ? '
-                               GROUP BY ' . $groupBy : '') . (strlen($orderBy) ? '
-                               ORDER BY ' . $orderBy : '') . (strlen($limit) ? '
+                               FROM ' . $this->compileFromTables($components['FROM']) . ($where !== '' ? '
+                               WHERE ' . $where : '') . ($groupBy !== '' ? '
+                               GROUP BY ' . $groupBy : '') . ($orderBy !== '' ? '
+                               ORDER BY ' . $orderBy : '') . ((string)$limit !== '' ? '
                                LIMIT ' . $limit : '');
                return $query;
        }
@@ -1553,7 +1553,7 @@ class SqlParser {
                $query = 'UPDATE ' . $components['TABLE'] . ' SET
                                ' . implode(',
                                ', $fields) . '
-                               ' . (strlen($where) ? '
+                               ' . ($where !== '' ? '
                                WHERE ' . $where : '');
                return $query;
        }
@@ -1607,7 +1607,7 @@ class SqlParser {
                // Where clause:
                $where = $this->compileWhereClause($components['WHERE']);
                // Make query:
-               $query = 'DELETE FROM ' . $components['TABLE'] . (strlen($where) ? '
+               $query = 'DELETE FROM ' . $components['TABLE'] . ($where !== '' ? '
                                WHERE ' . $where : '');
                return $query;
        }
@@ -1919,7 +1919,7 @@ class SqlParser {
                // Set type:
                $cfg = $fieldCfg['fieldType'];
                // Add value, if any:
-               if (strlen($fieldCfg['value'])) {
+               if ((string)$fieldCfg['value'] !== '') {
                        $cfg .= '(' . $fieldCfg['value'] . ')';
                }
                // Add additional features:
index 9949b22..cce5cd3 100644 (file)
@@ -152,7 +152,7 @@ Uncaught TYPO3 Exception ' . $exceptionCodeNumber . $exception->getMessage() . L
                                $arguments = '';
                                if (isset($step['args']) && is_array($step['args'])) {
                                        foreach ($step['args'] as $argument) {
-                                               $arguments .= strlen($arguments) === 0 ? '' : '<span style="color:white;">,</span> ';
+                                               $arguments .= (string)$arguments === '' ? '' : '<span style="color:white;">,</span> ';
                                                if (is_object($argument)) {
                                                        $arguments .= '<span style="color:#FF8700;"><em>' . get_class($argument) . '</em></span>';
                                                } elseif (is_string($argument)) {
index e9d0db6..a42e3cc 100644 (file)
@@ -30,7 +30,7 @@ namespace TYPO3\CMS\Core\Error;
  *
  * @author Ingo Renner <ingo@typo3.org>
  */
-class ProductionExceptionHandler extends \TYPO3\CMS\Core\Error\AbstractExceptionHandler {
+class ProductionExceptionHandler extends AbstractExceptionHandler {
 
        /**
         * Default title for error messages
@@ -58,7 +58,7 @@ class ProductionExceptionHandler extends \TYPO3\CMS\Core\Error\AbstractException
        /**
         * Echoes an exception for the web.
         *
-        * @param Exception $exception The exception
+        * @param \Exception $exception The exception
         * @return void
         */
        public function echoExceptionWeb(\Exception $exception) {
@@ -71,7 +71,7 @@ class ProductionExceptionHandler extends \TYPO3\CMS\Core\Error\AbstractException
        /**
         * Echoes an exception for the command line.
         *
-        * @param Exception $exception The exception
+        * @param \Exception $exception The exception
         * @return void
         */
        public function echoExceptionCLI(\Exception $exception) {
@@ -82,7 +82,7 @@ class ProductionExceptionHandler extends \TYPO3\CMS\Core\Error\AbstractException
        /**
         * Determines, whether Exception details should be outputted
         *
-        * @param Exception $exception The exception
+        * @param \Exception $exception The exception
         * @return boolean
         */
        protected function discloseExceptionInformation(\Exception $exception) {
@@ -100,12 +100,13 @@ class ProductionExceptionHandler extends \TYPO3\CMS\Core\Error\AbstractException
        /**
         * Returns the title for the error message
         *
-        * @param Exception $exception Exception causing the error
+        * @param \Exception $exception Exception causing the error
         * @return string
         */
        protected function getTitle(\Exception $exception) {
-               if ($this->discloseExceptionInformation($exception) && method_exists($exception, 'getTitle') && strlen($exception->getTitle()) > 0) {
-                       return htmlspecialchars($exception->getTitle());
+               $title = method_exists($exception, 'getTitle') ? $exception->getTitle() : '';
+               if ($this->discloseExceptionInformation($exception) && $title !== '') {
+                       return htmlspecialchars($title);
                } else {
                        return $this->defaultTitle;
                }
@@ -114,7 +115,7 @@ class ProductionExceptionHandler extends \TYPO3\CMS\Core\Error\AbstractException
        /**
         * Returns the message for the error message
         *
-        * @param Exception $exception Exception causing the error
+        * @param \Exception $exception Exception causing the error
         * @return string
         */
        protected function getMessage(\Exception $exception) {
index c66df9d..65c1cac 100644 (file)
@@ -797,10 +797,10 @@ class HtmlParser {
                                                                        $tagAttrib = $this->get_tag_attributes($tagParts[1]);
                                                                        $tagParts[1] = '';
                                                                        foreach ($tags[$tagName]['fixAttrib'] as $attr => $params) {
-                                                                               if (strlen($params['set'])) {
+                                                                               if ($params['set'] !== '') {
                                                                                        $tagAttrib[0][$attr] = $params['set'];
                                                                                }
-                                                                               if (isset($params['unset']) && !empty($params['unset'])) {
+                                                                               if (!empty($params['unset'])) {
                                                                                        unset($tagAttrib[0][$attr]);
                                                                                }
                                                                                if (!isset($tagAttrib[0][$attr]) && (string)$params['default'] !== '') {
@@ -1077,7 +1077,7 @@ class HtmlParser {
                $content = implode('', $parts);
                // Fix <style> section:
                $prefix = isset($alternatives['style']) ? $alternatives['style'] : $main_prefix;
-               if (strlen($prefix)) {
+               if ($prefix !== '') {
                        $parts = $this->splitIntoBlock('style', $content);
                        foreach ($parts as $k => &$part) {
                                if ($k % 2) {
index 37452ac..d599136 100644 (file)
@@ -1715,7 +1715,7 @@ class RteHtmlParser extends \TYPO3\CMS\Core\Html\HtmlParser {
                                $attribArray = $this->get_tag_attributes_classic($this->getFirstTag($v), 1);
                                // Checking if there is a scheme, and if not, prepend the current url.
                                // ONLY do this if href has content - the <a> tag COULD be an anchor and if so, it should be preserved...
-                               if (strlen($attribArray['href'])) {
+                               if ($attribArray['href'] !== '') {
                                        $uP = parse_url(strtolower($attribArray['href']));
                                        if (!$uP['scheme']) {
                                                $attribArray['href'] = $this->siteUrl() . substr($attribArray['href'], strlen($this->relBackPath));
index 0963f31..66fcd10 100644 (file)
@@ -847,7 +847,11 @@ class GraphicalFunctions {
         * @todo Define visibility
         */
        public function addToMap($cords, $conf) {
-               $this->map .= '<area' . ' shape="poly"' . ' coords="' . implode(',', $cords) . '"' . ' href="' . htmlspecialchars($conf['url']) . '"' . ($conf['target'] ? ' target="' . htmlspecialchars($conf['target']) . '"' : '') . $JS . (strlen($conf['titleText']) ? ' title="' . htmlspecialchars($conf['titleText']) . '"' : '') . ' alt="' . htmlspecialchars($conf['altText']) . '" />';
+               $this->map .= '<area' . ' shape="poly"' . ' coords="' . implode(',', $cords) . '"'
+                       . ' href="' . htmlspecialchars($conf['url']) . '"'
+                       . ($conf['target'] ? ' target="' . htmlspecialchars($conf['target']) . '"' : '') . $JS
+                       . ((string)$conf['titleText'] !== '' ? ' title="' . htmlspecialchars($conf['titleText']) . '"' : '')
+                       . ' alt="' . htmlspecialchars($conf['altText']) . '" />';
        }
 
        /**
@@ -1085,14 +1089,14 @@ class GraphicalFunctions {
                                // Process each type of split rendering keyword:
                                switch ((string) $splitRendering[$key]) {
                                        case 'highlightWord':
-                                               if (strlen($cfg['value'])) {
+                                               if ((string)$cfg['value'] !== '') {
                                                        $newResult = array();
                                                        // Traverse the current parts of the result array:
                                                        foreach ($result as $part) {
                                                                // Explode the string value by the word value to highlight:
                                                                $explodedParts = explode($cfg['value'], $part['str']);
                                                                foreach ($explodedParts as $c => $expValue) {
-                                                                       if (strlen($expValue)) {
+                                                                       if ((string)$expValue !== '') {
                                                                                $newResult[] = array_merge($part, array('str' => $expValue));
                                                                        }
                                                                        if ($c + 1 < count($explodedParts)) {
@@ -1116,7 +1120,7 @@ class GraphicalFunctions {
                                                }
                                                break;
                                        case 'charRange':
-                                               if (strlen($cfg['value'])) {
+                                               if ((string)$cfg['value'] !== '') {
                                                        // Initialize range:
                                                        $ranges = GeneralUtility::trimExplode(',', $cfg['value'], TRUE);
                                                        foreach ($ranges as $i => $rangeDef) {
@@ -1150,7 +1154,7 @@ class GraphicalFunctions {
                                                                        // Switch bank:
                                                                        if ($inRange != $currentState && !GeneralUtility::inList('32,10,13,9', $uNumber)) {
                                                                                // Set result:
-                                                                               if (strlen($bankAccum)) {
+                                                                               if ($bankAccum !== '') {
                                                                                        $newResult[] = array(
                                                                                                'str' => $bankAccum,
                                                                                                'fontSize' => $currentState && $cfg['fontSize'] ? $cfg['fontSize'] : $part['fontSize'],
@@ -1170,7 +1174,7 @@ class GraphicalFunctions {
                                                                        $bankAccum .= $utfChar;
                                                                }
                                                                // Set result for FINAL part:
-                                                               if (strlen($bankAccum)) {
+                                                               if ($bankAccum !== '') {
                                                                        $newResult[] = array(
                                                                                'str' => $bankAccum,
                                                                                'fontSize' => $currentState && $cfg['fontSize'] ? $cfg['fontSize'] : $part['fontSize'],
index bdff2ce..4bc4e85 100644 (file)
@@ -260,7 +260,7 @@ class Rfc822AddressesParser {
                if ($is_group && $address[0] === ',') {
                        $address = trim(substr($address, 1));
                        return $address;
-               } elseif (strlen($address) > 0) {
+               } elseif ($address !== '') {
                        return $address;
                } else {
                        return '';
@@ -415,7 +415,7 @@ class Rfc822AddressesParser {
                // If a group then split on comma and put into an array.
                // Otherwise, Just put the whole address in an array.
                if ($is_group) {
-                       while (strlen($address['address']) > 0) {
+                       while ($address['address'] !== '') {
                                $parts = explode(',', $address['address']);
                                $addresses[] = $this->_splitCheck($parts, ',');
                                $address['address'] = trim(substr($address['address'], strlen(end($addresses) . ',')));
@@ -551,7 +551,7 @@ class Rfc822AddressesParser {
                $comments = array();
                // Catch any RFC822 comments and store them separately.
                $_mailbox = $mailbox;
-               while (strlen(trim($_mailbox)) > 0) {
+               while (trim($_mailbox) !== '') {
                        $parts = explode('(', $_mailbox);
                        $before_comment = $this->_splitCheck($parts, '(');
                        if ($before_comment != $_mailbox) {
index 036c6ae..ba8856e 100644 (file)
@@ -247,7 +247,7 @@ class SwiftMailerAdapter implements \TYPO3\CMS\Core\Mail\MailerAdapterInterface
                                                }
                                        } elseif (preg_match('/^content-transfer-encoding:(.*)$/i', $line, $matches)) {
                                                $encoding = trim($matches[1]);
-                                       } elseif (strlen(trim($line)) == 0) {
+                                       } elseif (trim($line) === '') {
                                                // empty line before actual content of this part
                                                break;
                                        }
@@ -333,7 +333,7 @@ class SwiftMailerAdapter implements \TYPO3\CMS\Core\Mail\MailerAdapterInterface
                        $fromAddress = $this->message->getReturnPath();
                        $fromName = $fromAddress;
                }
-               if (strlen($fromAddress) == 0) {
+               if ($fromAddress === '') {
                        $fromAddress = 'no-reply@example.org';
                        $fromName = 'TYPO3 CMS';
                }
index 104cf6d..be0632d 100644 (file)
@@ -496,7 +496,7 @@ class PageRenderer implements \TYPO3\CMS\Core\SingletonInterface {
                $this->reset();
                $this->csConvObj = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Charset\\CharsetConverter');
                $this->locales = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Localization\\Locales');
-               if (strlen($templateFile)) {
+               if ($templateFile !== '') {
                        $this->templateFile = $templateFile;
                }
                $this->backPath = isset($backPath) ? $backPath : $GLOBALS['BACK_PATH'];
index 15bd0d6..3de6813 100644 (file)
@@ -161,7 +161,7 @@ class FileExtensionFilter {
                $returnValue = NULL;
                if (is_array($inputArgument)) {
                        $returnValue = $inputArgument;
-               } elseif (strlen($inputArgument) > 0) {
+               } elseif ((string)$inputArgument !== '') {
                        $returnValue = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $inputArgument);
                }
 
index bb55922..d4fb273 100644 (file)
@@ -70,7 +70,7 @@ class UserFileInlineLabelService {
                                        $value = BackendUtility::getRecordTitlePrep($fileRecord[$field]);
                                }
                        }
-                       if (!strlen($value)) {
+                       if ((string)$value === '') {
                                continue;
                        }
                        $labelText = LocalizationUtility::translate('LLL:EXT:lang/locallang_tca.xlf:sys_file.' . $field, 'lang');
index 0aebc00..725a5de 100644 (file)
@@ -211,7 +211,7 @@ class TimeTracker {
        public function setTSselectQuery(array $data, $msg = '') {
                end($this->currentHashPointer);
                $k = current($this->currentHashPointer);
-               if (strlen($msg)) {
+               if ($msg !== '') {
                        $data['msg'] = $msg;
                }
                $this->tsStackLog[$k]['selectQuery'][] = $data;
@@ -429,7 +429,7 @@ class TimeTracker {
                                $BTM = $ac == $c ? 'bottom' : '';
                                $PM = is_array($arr[$k . '.']) ? ($deeper ? 'minus' : 'plus') : 'join';
                                $this->tsStackLog[$v]['icons'] = $depthData . ($first ? '' : '<img src="' . TYPO3_mainDir . 'gfx/ol/' . $PM . $BTM . '.gif" width="18" height="16" align="top" border="0" alt="" />');
-                               if (strlen($this->tsStackLog[$v]['content'])) {
+                               if ($this->tsStackLog[$v]['content'] !== '') {
                                        $content = str_replace($this->tsStackLog[$v]['content'], $v, $content);
                                }
                                if (is_array($arr[$k . '.'])) {
@@ -451,7 +451,7 @@ class TimeTracker {
                // Traverse array again, this time substitute the unique hash with the red key
                foreach ($arr as $k => $v) {
                        if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($k)) {
-                               if (strlen($this->tsStackLog[$v]['content'])) {
+                               if ($this->tsStackLog[$v]['content'] !== '') {
                                        $content = str_replace($v, '<strong style="color:red;">[' . $this->tsStackLog[$v]['key'] . ']</strong>', $content);
                                }
                        }
index b18ef06..d03f40d 100644 (file)
@@ -1173,14 +1173,10 @@ class TypoScriptParser {
                                                if (!$highlightBlockMode || $set[0] !== 'prespace') {
                                                        $lineC .= $st[0] . htmlspecialchars($part) . $st[1];
                                                }
-                                       } elseif ($len < 0) {
-                                               debug(array($len, $value, $rawP));
                                        }
                                }
-                       } else {
-                               debug(array($value));
                        }
-                       if (strlen(substr($value, $start))) {
+                       if (strlen($value) > $start) {
                                $lineC .= $this->highLightStyles['ignored'][0] . htmlspecialchars(substr($value, $start)) . $this->highLightStyles['ignored'][1];
                        }
                        if ($errA[$rawP]) {
index 39c0b22..1f5cadf 100644 (file)
@@ -434,7 +434,7 @@ class ExtensionManagementUtility {
                }
                // Make sure item keys are integers
                $GLOBALS['TCA'][$table]['columns'][$field]['config']['items'] = array_values($GLOBALS['TCA'][$table]['columns'][$field]['config']['items']);
-               if (strlen($relativePosition) > 0) {
+               if ((string)$relativePosition !== '') {
                        // Insert at specified position
                        $matchedPosition = \TYPO3\CMS\Core\Utility\ArrayUtility::filterByValueRecursive($relativeToField, $GLOBALS['TCA'][$table]['columns'][$field]['config']['items']);
                        if (count($matchedPosition) > 0) {
@@ -761,7 +761,7 @@ class ExtensionManagementUtility {
                }
                \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($defaultModuleConfiguration, $moduleConfiguration);
                $moduleConfiguration = $defaultModuleConfiguration;
-               if (strlen($subModuleName) > 0) {
+               if ($subModuleName !== '') {
                        $moduleSignature = $mainModuleName . '_' . $subModuleName;
                } else {
                        $moduleSignature = $mainModuleName;
index f49da58..a022c9c 100644 (file)
@@ -950,7 +950,7 @@ class GeneralUtility {
         */
        static public function formatSize($sizeInBytes, $labels = '') {
                // Set labels:
-               if (strlen($labels) == 0) {
+               if ($labels === '') {
                        $labels = ' | K| M| G';
                } else {
                        $labels = str_replace('"', '', $labels);
@@ -1635,7 +1635,7 @@ class GeneralUtility {
                } else {
                        $p = explode('&', $string);
                        foreach ($p as $v) {
-                               if (strlen($v)) {
+                               if ((string)$v !== '') {
                                        list($pK, $pV) = explode('=', $v, 2);
                                        $output[rawurldecode($pK)] = rawurldecode($pV);
                                }
@@ -2266,7 +2266,7 @@ class GeneralUtility {
                        // Closing tag.
                        $tagName = $tagName[0] === 'n' && MathUtility::canBeInterpretedAsInteger($testNtag) ? (int)$testNtag : $tagName;
                        // Test for alternative index value:
-                       if (strlen($val['attributes']['index'])) {
+                       if ($val['attributes']['index'] !== '') {
                                $tagName = $val['attributes']['index'];
                        }
                        // Setting tag-values, manage stack:
@@ -2534,7 +2534,7 @@ Connection: close
                                        }
                                }
                                $content .= $line;
-                               if (!strlen(trim($line))) {
+                               if (trim($line) === '') {
                                        // Stop at the first empty line (= end of header)
                                        break;
                                }
@@ -2636,7 +2636,7 @@ Connection: close
                                // Set createGroup if not empty
                                if (
                                        isset($GLOBALS['TYPO3_CONF_VARS']['BE']['createGroup'])
-                                       && strlen($GLOBALS['TYPO3_CONF_VARS']['BE']['createGroup']) > 0
+                                       && $GLOBALS['TYPO3_CONF_VARS']['BE']['createGroup'] !== ''
                                ) {
                                        // "@" is there because file is not necessarily OWNED by the user
                                        $changeGroupResult = @chgrp($path, $GLOBALS['TYPO3_CONF_VARS']['BE']['createGroup']);
@@ -2759,7 +2759,7 @@ Connection: close
                        throw new \InvalidArgumentException('The specified directory is of type "' . gettype($deepDirectory) . '" but a string is expected.', 1303662956);
                }
                $fullPath = $directory . $deepDirectory;
-               if (!is_dir($fullPath) && strlen($fullPath) > 0) {
+               if ($fullPath !== '' && !is_dir($fullPath)) {
                        $firstCreatedPath = self::createDirectoryPath($fullPath);
                        if ($firstCreatedPath !== '') {
                                self::fixPermissions($firstCreatedPath, TRUE);
@@ -2961,7 +2961,7 @@ Connection: close
                $dirs = self::get_dirs($path);
                if ($recursivityLevels > 0 && is_array($dirs)) {
                        foreach ($dirs as $subdirs) {
-                               if ((string) $subdirs != '' && (!strlen($excludePattern) || !preg_match(('/^' . $excludePattern . '$/'), $subdirs))) {
+                               if ((string) $subdirs != '' && ($excludePattern === '' || !preg_match(('/^' . $excludePattern . '$/'), $subdirs))) {
                                        $fileArr = self::getAllFilesAndFoldersInPath($fileArr, $path . $subdirs . '/', $extList, $regDirs, $recursivityLevels - 1, $excludePattern);
                                }
                        }
index 445f8c9..3bae866 100644 (file)
@@ -206,7 +206,7 @@ class MailUtility {
                                        $afterParts = explode(' ', substr($str, $lineWidth + $substrStart), 2);
                                        $theLine = $substr . $afterParts[0];
                                }
-                               if (!strlen($theLine)) {
+                               if ($theLine === '') {
                                        // prevent endless loop because of empty line
                                        break;
                                }
index 5462b5b..2505664 100644 (file)
@@ -41,6 +41,7 @@ class StringUtility {
         * @param string $haystack Full string to check
         * @param string $needle Reference string which must be found as the "last part" of the full string
         * @return boolean TRUE if $needle was found to be equal to the last part of $str
+        * @throws \InvalidArgumentException
         */
        static public function isLastPartOfString($haystack, $needle) {
                        // Sanitize $haystack and $needle
index 1235ace..9496a9f 100644 (file)
@@ -35,7 +35,7 @@ class SystemConstraint extends \TYPO3\Flow\Package\MetaData\AbstractConstraint {
         * @param string $maxVersion
         */
        public function __construct($constraintType, $type, $value = NULL, $minVersion = NULL, $maxVersion = NULL) {
-               if (!strlen($value)) {
+               if ($value === '') {
                        $value = NULL;
                }
                parent::__construct($constraintType, $value, $minVersion, $maxVersion);
index 914d724..7d8e30e 100644 (file)
@@ -164,7 +164,7 @@ class Files {
                if (is_file($path)) {
                        throw new \TYPO3\Flow\Utility\Exception('Could not create directory "' . $path . '", because a file with that name exists!', 1349340620);
                }
-               if (!is_dir($path) && strlen($path) > 0) {
+               if ($path !== '' && !is_dir($path)) {
                        $oldMask = umask(000);
                        mkdir($path, 0777, TRUE);
                        umask($oldMask);
index 4c58f6d..8013061 100644 (file)
@@ -704,7 +704,7 @@ class HelpModuleController {
         * @todo Define visibility
         */
        public function substituteGlossaryWords_htmlcleaner_callback($code) {
-               if (is_array($this->substWords) && count($this->substWords) && strlen(trim($code))) {
+               if (is_array($this->substWords) && count($this->substWords) && trim($code) !== '') {
                        // Substitute words:
                        foreach ($this->substWords as $wordKey => $wordSet) {
                                // quoteMeta used so special chars (which should not occur though) in words will not break the regex. Seemed to work (- kasper)
index d46fd1b..f13d662 100644 (file)
@@ -463,7 +463,7 @@ class DatabaseConnection extends \TYPO3\CMS\Core\Database\DatabaseConnection {
                                        $sqlResult = $this->handlerInstance[$this->lastHandlerKey]->_query($this->lastQuery, FALSE);
                                } else {
                                        $this->handlerInstance[$this->lastHandlerKey]->StartTrans();
-                                       if (strlen($this->lastQuery[0])) {
+                                       if ($this->lastQuery[0] !== '') {
                                                $sqlResult = $this->handlerInstance[$this->lastHandlerKey]->_query($this->lastQuery[0], FALSE);
                                        }
                                        if (is_array($this->lastQuery[1])) {
@@ -624,7 +624,7 @@ class DatabaseConnection extends \TYPO3\CMS\Core\Database\DatabaseConnection {
                                        $sqlResult = $this->handlerInstance[$this->lastHandlerKey]->_query($this->lastQuery, FALSE);
                                } else {
                                        $this->handlerInstance[$this->lastHandlerKey]->StartTrans();
-                                       if (strlen($this->lastQuery[0])) {
+                                       if ($this->lastQuery[0] !== '') {
                                                $sqlResult = $this->handlerInstance[$this->lastHandlerKey]->_query($this->lastQuery[0], FALSE);
                                        }
                                        if (is_array($this->lastQuery[1])) {
@@ -1098,7 +1098,7 @@ class DatabaseConnection extends \TYPO3\CMS\Core\Database\DatabaseConnection {
                                        $query[0] = 'UPDATE ' . $this->quoteFromTables($table) . '
                                                SET
                                                        ' . implode(',
-                                                       ', $nArr) . (strlen($where) > 0 ? '
+                                                       ', $nArr) . ($where !== '' ? '
                                                WHERE
                                                        ' . $this->quoteWhereClause($where) : '');
                                }
@@ -1115,7 +1115,7 @@ class DatabaseConnection extends \TYPO3\CMS\Core\Database\DatabaseConnection {
                                $query = 'UPDATE ' . $this->quoteFromTables($table) . '
                                        SET
                                                ' . implode(',
-                                               ', $nArr) . (strlen($where) > 0 ? '
+                                               ', $nArr) . ($where !== '' ? '
                                        WHERE
                                                ' . $this->quoteWhereClause($where) : '');
                                if ($this->debugOutput || $this->store_lastBuiltQuery) {
@@ -1143,7 +1143,7 @@ class DatabaseConnection extends \TYPO3\CMS\Core\Database\DatabaseConnection {
                        }
                        $table = $this->quoteFromTables($table);
                        $where = $this->quoteWhereClause($where);
-                       $query = 'DELETE FROM ' . $table . (strlen($where) > 0 ? ' WHERE ' . $where : '');
+                       $query = 'DELETE FROM ' . $table . ($where !== '' ? ' WHERE ' . $where : '');
                        if ($this->debugOutput || $this->store_lastBuiltQuery) {
                                $this->debug_lastBuiltQuery = $query;
                        }
@@ -2944,7 +2944,7 @@ class DatabaseConnection extends \TYPO3\CMS\Core\Database\DatabaseConnection {
                                                $this->handlerInstance[$handlerKey]->PConnect($cfgArray['config']['host'] . (isset($cfgArray['config']['port']) ? ':' . $cfgArray['config']['port'] : ''), $cfgArray['config']['username'], $cfgArray['config']['password'], $cfgArray['config']['database']);
                                        }
                                        if (!$this->handlerInstance[$handlerKey]->isConnected()) {
-                                               $dsn = $cfgArray['config']['driver'] . '://' . $cfgArray['config']['username'] . (strlen($cfgArray['config']['password']) ? ':XXXX@' : '') . $cfgArray['config']['host'] . (isset($cfgArray['config']['port']) ? ':' . $cfgArray['config']['port'] : '') . '/' . $cfgArray['config']['database'] . ($GLOBALS['TYPO3_CONF_VARS']['SYS']['no_pconnect'] ? '' : '?persistent=1');
+                                               $dsn = $cfgArray['config']['driver'] . '://' . $cfgArray['config']['username'] . ($cfgArray['config']['password'] !== '' ? ':XXXX@' : '') . $cfgArray['config']['host'] . (isset($cfgArray['config']['port']) ? ':' . $cfgArray['config']['port'] : '') . '/' . $cfgArray['config']['database'] . ($GLOBALS['TYPO3_CONF_VARS']['SYS']['no_pconnect'] ? '' : '?persistent=1');
                                                GeneralUtility::sysLog('Could not connect to DB server using ADOdb on ' . $cfgArray['config']['host'] . ' with user ' . $cfgArray['config']['username'] . '.', 'Core', 4);
                                                error_log('DBAL error: Connection to ' . $dsn . ' failed. Maybe PHP doesn\'t support the database?');
                                                $output = FALSE;
@@ -3579,7 +3579,7 @@ class DatabaseConnection extends \TYPO3\CMS\Core\Database\DatabaseConnection {
                                                $parseResults['ORDERBY'] = $this->SQLparser->debug_parseSQLpart('SELECT', $inData['args'][4]);
                                                // Using select field list syntax
                                                foreach ($parseResults as $k => $v) {
-                                                       if (!strlen($parseResults[$k])) {
+                                                       if ($v === '') {
                                                                unset($parseResults[$k]);
                                                        }
                                                }
index 6c75b15..2fee1b8 100644 (file)
@@ -380,7 +380,7 @@ class SqlParser extends \TYPO3\CMS\Core\Database\SqlParser {
                                $type = $GLOBALS['TYPO3_DB']->MySQLMetaType($fieldCfg['fieldType']);
                                $cfg = $type;
                                // Add value, if any:
-                               if (strlen($fieldCfg['value']) && in_array($type, array('C', 'C2'))) {
+                               if ((string)$fieldCfg['value'] !== '' && in_array($type, array('C', 'C2'))) {
                                        $cfg .= ' ' . $fieldCfg['value'];
                                } elseif (!isset($fieldCfg['value']) && in_array($type, array('C', 'C2'))) {
                                        $cfg .= ' 255';
index 2fb9d5e..bcf54a8 100644 (file)
@@ -296,7 +296,7 @@ class DocumentationService {
                                                GeneralUtility::mkdir_deep($path, implode('/', $zipEntryPathSegments));
                                        } else {
                                                $absoluteTargetPath = GeneralUtility::getFileAbsFileName($path . implode('/', $zipEntryPathSegments) . '/' . $fileName);
-                                               if (strlen(trim($absoluteTargetPath)) > 0) {
+                                               if (trim($absoluteTargetPath) !== '') {
                                                        $return = GeneralUtility::writeFile(
                                                                $absoluteTargetPath, zip_entry_read($zipEntry, zip_entry_filesize($zipEntry))
                                                        );
index c241356..bee9acf 100644 (file)
@@ -189,7 +189,7 @@ class BackendConfigurationManager extends \TYPO3\CMS\Extbase\Configuration\Abstr
                $storagePids = \TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $storagePid);
                foreach ($storagePids as $startPid) {
                        $pids = $this->queryGenerator->getTreeList($startPid, $recursionDepth, 0, 1);
-                       if (strlen($pids) > 0) {
+                       if ((string)$pids !== '') {
                                $recursiveStoragePids .= $pids . ',';
                        }
                }
index d2674dd..287434f 100644 (file)
@@ -118,7 +118,7 @@ class FrontendConfigurationManager extends \TYPO3\CMS\Extbase\Configuration\Abst
         */
        protected function overrideStoragePidIfStartingPointIsSet(array $frameworkConfiguration) {
                $pages = $this->contentObject->data['pages'];
-               if (is_string($pages) && strlen($pages) > 0) {
+               if (is_string($pages) && $pages !== '') {
                        $list = array();
                        if ($this->contentObject->data['recursive'] > 0) {
                                $explodedPages = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $pages);
@@ -167,7 +167,7 @@ class FrontendConfigurationManager extends \TYPO3\CMS\Extbase\Configuration\Abst
        protected function overrideConfigurationFromFlexForm(array $frameworkConfiguration) {
                $flexFormConfiguration = $this->contentObject->data['pi_flexform'];
                if (is_string($flexFormConfiguration)) {
-                       if (strlen($flexFormConfiguration) > 0) {
+                       if ($flexFormConfiguration !== '') {
                                $flexFormConfiguration = $this->flexFormService->convertFlexFormContentToArray($flexFormConfiguration);
                        } else {
                                $flexFormConfiguration = array();
@@ -246,7 +246,7 @@ class FrontendConfigurationManager extends \TYPO3\CMS\Extbase\Configuration\Abst
                $storagePids = \TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $storagePid);
                foreach ($storagePids as $startPid) {
                        $pids = $this->getContentObject()->getTreeList($startPid, $recursionDepth, 0);
-                       if (strlen($pids) > 0) {
+                       if ((string)$pids !== '') {
                                $recursiveStoragePids .= $pids . ',';
                        }
                }
index a4683da..e6ba1a1 100644 (file)
@@ -89,10 +89,10 @@ class Bootstrap implements \TYPO3\CMS\Extbase\Core\BootstrapInterface {
         */
        public function initialize($configuration) {
                if (!$this->isInCliMode()) {
-                       if (!isset($configuration['extensionName']) || strlen($configuration['extensionName']) === 0) {
+                       if (!isset($configuration['extensionName']) || $configuration['extensionName'] === '') {
                                throw new \RuntimeException('Invalid configuration: "extensionName" is not set', 1290623020);
                        }
-                       if (!isset($configuration['pluginName']) || strlen($configuration['pluginName']) === 0) {
+                       if (!isset($configuration['pluginName']) || $configuration['pluginName'] === '') {
                                throw new \RuntimeException('Invalid configuration: "pluginName" is not set', 1290623027);
                        }
                }
index e3f6578..ea01838 100644 (file)
@@ -338,7 +338,7 @@ class ActionController extends \TYPO3\CMS\Extbase\Mvc\Controller\AbstractControl
                }
                if ($actionResult === NULL && $this->view instanceof ViewInterface) {
                        $this->response->appendContent($this->view->render());
-               } elseif (is_string($actionResult) && strlen($actionResult) > 0) {
+               } elseif (is_string($actionResult) && $actionResult !== '') {
                        $this->response->appendContent($actionResult);
                } elseif (is_object($actionResult) && method_exists($actionResult, '__toString')) {
                        $this->response->appendContent((string)$actionResult);
@@ -463,7 +463,7 @@ class ActionController extends \TYPO3\CMS\Extbase\Mvc\Controller\AbstractControl
                // @todo remove handling of deprecatedSetting two versions after 6.2
                if (
                        isset($extbaseFrameworkConfiguration['view'][$deprecatedSetting])
-                       && strlen($extbaseFrameworkConfiguration['view'][$deprecatedSetting]) > 0
+                       && (string)$extbaseFrameworkConfiguration['view'][$deprecatedSetting] !== ''
                ) {
                        $values[] = $extbaseFrameworkConfiguration['view'][$deprecatedSetting];
                }
index d072164..7e47a95 100644 (file)
@@ -186,8 +186,8 @@ class Argument {
                if (!is_string($name)) {
                        throw new \InvalidArgumentException('$name must be of type string, ' . gettype($name) . ' given.', 1187951688);
                }
-               if (strlen($name) === 0) {
-                       throw new \InvalidArgumentException('$name must be a non-empty string, ' . strlen($name) . ' characters given.', 1232551853);
+               if ($name === '') {
+                       throw new \InvalidArgumentException('$name must be a non-empty string.', 1232551853);
                }
                $this->name = $name;
                $this->dataType = $dataType;
index 4e5cc32..68ad754 100644 (file)
@@ -203,7 +203,7 @@ class CommandController implements \TYPO3\CMS\Extbase\Mvc\Controller\CommandCont
                        $preparedArguments[] = $argument->getValue();
                }
                $commandResult = call_user_func_array(array($this, $this->commandMethodName), $preparedArguments);
-               if (is_string($commandResult) && strlen($commandResult) > 0) {
+               if (is_string($commandResult) && $commandResult !== '') {
                        $this->response->appendContent($commandResult);
                } elseif (is_object($commandResult) && method_exists($commandResult, '__toString')) {
                        $this->response->appendContent((string) $commandResult);
index d3006f0..7f17f3f 100644 (file)
@@ -388,7 +388,7 @@ class Request implements \TYPO3\CMS\Extbase\Mvc\RequestInterface {
         * @return void
         */
        public function setArgument($argumentName, $value) {
-               if (!is_string($argumentName) || strlen($argumentName) == 0) {
+               if (!is_string($argumentName) || $argumentName === '') {
                        throw new \TYPO3\CMS\Extbase\Mvc\Exception\InvalidArgumentNameException('Invalid argument name.', 1210858767);
                }
                if ($argumentName[0] === '_' && $argumentName[1] === '_') {
index c2a0875..f2ad627 100644 (file)
@@ -154,7 +154,7 @@ class RequestBuilder implements \TYPO3\CMS\Core\SingletonInterface {
                $request->setRequestUri(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_REQUEST_URL'));
                $request->setBaseUri(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL'));
                $request->setMethod($this->environmentService->getServerRequestMethod());
-               if (is_string($parameters['format']) && strlen($parameters['format'])) {
+               if (is_string($parameters['format']) && $parameters['format'] !== '') {
                        $request->setFormat(filter_var($parameters['format'], FILTER_SANITIZE_STRING));
                } else {
                        $request->setFormat($this->defaultFormat);
@@ -177,8 +177,8 @@ class RequestBuilder implements \TYPO3\CMS\Core\SingletonInterface {
         * @return string
         */
        protected function resolveControllerName(array $parameters) {
-               if (!isset($parameters['controller']) || strlen($parameters['controller']) === 0) {
-                       if (strlen($this->defaultControllerName) === 0) {
+               if (!isset($parameters['controller']) || $parameters['controller'] === '') {
+                       if ($this->defaultControllerName === '') {
                                throw new \TYPO3\CMS\Extbase\Mvc\Exception('The default controller for extension "' . $this->extensionName . '" and plugin "' . $this->pluginName . '" can not be determined. Please check for TYPO3\\CMS\\Extbase\\Utility\\ExtensionUtility::configurePlugin() in your ext_localconf.php.', 1316104317);
                        }
                        return $this->defaultControllerName;
@@ -210,8 +210,8 @@ class RequestBuilder implements \TYPO3\CMS\Core\SingletonInterface {
         */
        protected function resolveActionName($controllerName, array $parameters) {
                $defaultActionName = is_array($this->allowedControllerActions[$controllerName]) ? current($this->allowedControllerActions[$controllerName]) : '';
-               if (!isset($parameters['action']) || strlen($parameters['action']) === 0) {
-                       if (strlen($defaultActionName) === 0) {
+               if (!isset($parameters['action']) || $parameters['action'] === '') {
+                       if ($defaultActionName === '') {
                                throw new \TYPO3\CMS\Extbase\Mvc\Exception('The default action can not be determined for controller "' . $controllerName . '". Please check TYPO3\\CMS\\Extbase\\Utility\\ExtensionUtility::configurePlugin() in your ext_localconf.php.', 1295479651);
                        }
                        return $defaultActionName;
index 1857811..e7214e3 100644 (file)
@@ -112,10 +112,10 @@ class DataMapFactory implements \TYPO3\CMS\Core\SingletonInterface {
                        if (isset($classSettings['subclasses']) && is_array($classSettings['subclasses'])) {
                                $subclasses = $this->resolveSubclassesRecursive($frameworkConfiguration['persistence']['classes'], $classSettings['subclasses']);
                        }
-                       if (isset($classSettings['mapping']['recordType']) && strlen($classSettings['mapping']['recordType']) > 0) {
+                       if (isset($classSettings['mapping']['recordType']) && $classSettings['mapping']['recordType'] !== '') {
                                $recordType = $classSettings['mapping']['recordType'];
                        }
-                       if (isset($classSettings['mapping']['tableName']) && strlen($classSettings['mapping']['tableName']) > 0) {
+                       if (isset($classSettings['mapping']['tableName']) && $classSettings['mapping']['tableName'] !== '') {
                                $tableName = $classSettings['mapping']['tableName'];
                        }
                        $classHierarchy = array_merge(array($className), class_parents($className));
index 7519b8d..310c531 100644 (file)
@@ -534,7 +534,7 @@ class DataMapper implements \TYPO3\CMS\Core\SingletonInterface {
         * @return \TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMap The data map
         */
        public function getDataMap($className) {
-               if (!is_string($className) || strlen($className) === 0) {
+               if (!is_string($className) || $className === '') {
                        throw new \TYPO3\CMS\Extbase\Persistence\Generic\Exception('No class name was given to retrieve the Data Map for.', 1251315965);
                }
                if (!isset($this->dataMaps[$className])) {
index 4e98538..1561b31 100644 (file)
@@ -369,7 +369,7 @@ class Typo3DbBackend implements \TYPO3\CMS\Extbase\Persistence\Generic\Storage\B
                $this->parseLimitAndOffset($query->getLimit(), $query->getOffset(), $sql);
                $tableNames = array_unique(array_keys($sql['tables'] + $sql['unions']));
                foreach ($tableNames as $tableName) {
-                       if (is_string($tableName) && strlen($tableName) > 0) {
+                       if (is_string($tableName) && $tableName !== '') {
                                $this->addAdditionalWhereClause($query->getQuerySettings(), $tableName, $sql);
                        }
                }
@@ -1066,7 +1066,7 @@ class Typo3DbBackend implements \TYPO3\CMS\Extbase\Persistence\Generic\Storage\B
                                $tableName = $source->getLeft()->getSelectorName();
                        }
                        $columnName = $this->dataMapper->convertPropertyNameToColumnName($propertyName, $className);
-                       if (strlen($tableName) > 0) {
+                       if ($tableName !== '') {
                                $sql['orderings'][] = $tableName . '.' . $columnName . ' ' . $order;
                        } else {
                                $sql['orderings'][] = $columnName . ' ' . $order;
index f749a5e..7bb7c23 100644 (file)
@@ -139,7 +139,7 @@ class DateTimeConverter extends \TYPO3\CMS\Extbase\Property\TypeConverter\Abstra
                        } else {
                                throw new \TYPO3\CMS\Extbase\Property\Exception\TypeConverterException('Could not convert the given source into a DateTime object because it was not an array with a valid date as a string', 1308003914);
                        }
-                       if (isset($source['dateFormat']) && strlen($source['dateFormat']) > 0) {
+                       if (isset($source['dateFormat']) && $source['dateFormat'] !== '') {
                                $dateFormat = $source['dateFormat'];
                        }
                }
@@ -149,7 +149,7 @@ class DateTimeConverter extends \TYPO3\CMS\Extbase\Property\TypeConverter\Abstra
                if (ctype_digit($dateAsString) && $configuration === NULL && (!is_array($source) || !isset($source['dateFormat']))) {
                        $dateFormat = 'U';
                }
-               if (is_array($source) && isset($source['timezone']) && strlen($source['timezone']) !== 0) {
+               if (is_array($source) && isset($source['timezone']) && (string)$source['timezone'] !== '') {
                        try {
                                $timezone = new \DateTimeZone($source['timezone']);
                        } catch (\Exception $e) {
index c46ef9f..5b61718 100644 (file)
@@ -55,7 +55,7 @@ class FloatConverter extends \TYPO3\CMS\Extbase\Property\TypeConverter\AbstractT
         * @api
         */
        public function convertFrom($source, $targetType, array $convertedChildProperties = array(), \TYPO3\CMS\Extbase\Property\PropertyMappingConfigurationInterface $configuration = NULL) {
-               if ($source === NULL || strlen($source) === 0) {
+               if ($source === NULL || (string)$source === '') {
                        return NULL;
                }
                // We won't backport the full flavored locale parsing of floats from Flow here
index a99aeb4..d639286 100644 (file)
@@ -53,7 +53,7 @@ class IntegerConverter extends \TYPO3\CMS\Extbase\Property\TypeConverter\Abstrac
         * @api
         */
        public function convertFrom($source, $targetType, array $convertedChildProperties = array(), \TYPO3\CMS\Extbase\Property\PropertyMappingConfigurationInterface $configuration = NULL) {
-               if ($source === NULL || strlen($source) === 0) {
+               if ($source === NULL || (string)$source === '') {
                        return NULL;
                }
                if (!is_numeric($source)) {
index 9b9f094..9be0d73 100644 (file)
@@ -55,7 +55,7 @@ class DocCommentParser {
                $this->tags = array();
                $lines = explode(chr(10), $docComment);
                foreach ($lines as $line) {
-                       if (strlen($line) > 0 && strpos($line, '@') !== FALSE) {
+                       if ($line !== '' && strpos($line, '@') !== FALSE) {
                                $this->parseTag(substr($line, strpos($line, '@')));
                        } elseif (count($this->tags) === 0) {
                                $this->description .= preg_replace('/\\s*\\/?[\\\\*]*(.*)$/', '$1', $line) . chr(10);
index d8fa364..d2bc0e7 100644 (file)
@@ -244,10 +244,10 @@ class FieldProvider implements \TYPO3\CMS\Scheduler\AdditionalFieldProviderInter
                }
                $descriptionIndex = $labelNameIndex . '.description';
                $description = $this->getLanguageLabel($descriptionIndex);
-               if (strlen($description) === 0) {
+               if ($description === '') {
                        $description = $argument->getDescription();
                }
-               if (strlen($description) > 0) {
+               if ($description !== '') {
                        $label .= '. <em>' . htmlspecialchars($description) . '</em>';
                }
                return $label;
index aa4bdfb..090a5c4 100644 (file)
@@ -205,10 +205,10 @@ tt_content.' . $pluginSignature . ' {
                        'labels' => '',
                        'extRelPath' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath($extensionKey) . 'Classes/'
                );
-               if (strlen($mainModuleName) > 0 && !array_key_exists($mainModuleName, $GLOBALS['TBE_MODULES'])) {
+               if ($mainModuleName !== '' && !array_key_exists($mainModuleName, $GLOBALS['TBE_MODULES'])) {
                        $mainModuleName = $extensionName . \TYPO3\CMS\Core\Utility\GeneralUtility::underscoredToUpperCamelCase($mainModuleName);
                } else {
-                       $mainModuleName = strlen($mainModuleName) > 0 ? $mainModuleName : 'web';
+                       $mainModuleName = $mainModuleName !== '' ? $mainModuleName : 'web';
                }
                // add mandatory parameter to use new pagetree
                if ($mainModuleName === 'web') {
@@ -217,7 +217,7 @@ tt_content.' . $pluginSignature . ' {
                \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($defaultModuleConfiguration, $moduleConfiguration);
                $moduleConfiguration = $defaultModuleConfiguration;
                $moduleSignature = $mainModuleName;
-               if (strlen($subModuleName) > 0) {
+               if ($subModuleName !== '') {
                        $subModuleName = $extensionName . \TYPO3\CMS\Core\Utility\GeneralUtility::underscoredToUpperCamelCase($subModuleName);
                        $moduleSignature .= '_' . $subModuleName;
                }
index 23cb58f..b41cd20 100644 (file)
@@ -200,7 +200,7 @@ class LocalizationUtility {
                                        }
                                }
                        }
-               } elseif (strlen($GLOBALS['BE_USER']->uc['lang']) > 0) {
+               } elseif ($GLOBALS['BE_USER']->uc['lang'] !== '') {
                        self::$languageKey = $GLOBALS['BE_USER']->uc['lang'];
                }
        }
index 1789e17..35d9233 100644 (file)
@@ -437,7 +437,7 @@ class ValidatorResolver implements \TYPO3\CMS\Core\SingletonInterface {
                         */
                        list($extensionName, $extensionValidatorName) = explode(':', $validatorName);
 
-                       if ($validatorName !== $extensionName && strlen($extensionValidatorName) > 0) {
+                       if ($validatorName !== $extensionName && $extensionValidatorName !== '') {
                                /**
                                 * Shorthand custom
                                 */
index 67f2b77..2a12798 100644 (file)
@@ -361,7 +361,7 @@ class DateTimeConverterTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
         * @dataProvider convertFromArrayDataProvider
         */
        public function convertFromArrayTests(array $source, $isValid) {
-               $dateFormat = isset($source['dateFormat']) && strlen($source['dateFormat']) > 0 ? $source['dateFormat'] : NULL;
+               $dateFormat = isset($source['dateFormat']) && $source['dateFormat'] !== '' ? $source['dateFormat'] : NULL;
                if ($dateFormat !== NULL) {
                        $mockMappingConfiguration = $this->getMock('TYPO3\CMS\Extbase\Property\PropertyMappingConfigurationInterface');
                        $mockMappingConfiguration
index 4c21b1c..2d50aa0 100644 (file)
@@ -124,7 +124,7 @@ class ConfigurationUtility implements \TYPO3\CMS\Core\SingletonInterface {
 
                $theConstants = array();
 
-               if (strlen($rawConfigurationString) > 0) {
+               if ((string)$rawConfigurationString !== '') {
                        $extensionPathInformation = $this->getExtensionPathInformation($extensionKey);
 
                        $tsStyleConfig = $this->objectManager->get('TYPO3\\CMS\\Core\\TypoScript\\ConfigurationForm');
index 3b6da86..599747c 100644 (file)
@@ -95,10 +95,10 @@ $EM_CONF[$_EXTKEY] = ' . $emConf . ';
                if (!isset($emConf['constraints']) || !isset($emConf['constraints']['depends']) || !isset($emConf['constraints']['conflicts']) || !isset($emConf['constraints']['suggests'])) {
                        if (!isset($emConf['constraints']) || !isset($emConf['constraints']['depends'])) {
                                $emConf['constraints']['depends'] = $this->stringToDependency($emConf['dependencies']);
-                               if (strlen($emConf['PHP_version'])) {
+                               if ($emConf['PHP_version'] !== '') {
                                        $emConf['constraints']['depends']['php'] = $emConf['PHP_version'];
                                }
-                               if (strlen($emConf['TYPO3_version'])) {
+                               if ($emConf['TYPO3_version'] !== '') {
                                        $emConf['constraints']['depends']['typo3'] = $emConf['TYPO3_version'];
                                }
                        }
@@ -155,7 +155,7 @@ $EM_CONF[$_EXTKEY] = ' . $emConf . ';
         */
        public function stringToDependency($dependency) {
                $constraint = array();
-               if (is_string($dependency) && strlen($dependency)) {
+               if (is_string($dependency) && $dependency !== '') {
                        $dependency = explode(',', $dependency);
                        foreach ($dependency as $v) {
                                $constraint[$v] = '';
index 38ff77d..86ee107 100644 (file)
@@ -397,7 +397,7 @@ class FileHandlingUtility implements \TYPO3\CMS\Core\SingletonInterface {
                                        if (!is_dir($dir)) {
                                                GeneralUtility::mkdir_deep($extensionDir . $dir);
                                        }
-                                       if (strlen(trim($file)) > 0) {
+                                       if (trim($file) !== '') {
                                                $return = GeneralUtility::writeFile($extensionDir . $dir . '/' . $file, zip_entry_read($zipEntry, zip_entry_filesize($zipEntry)));
                                                if ($return === FALSE) {
                                                        throw new \TYPO3\CMS\Extensionmanager\Exception\ExtensionManagerException('Could not write file ' . $this->getRelativePath($file), 1344691048);
index 5a9a10a..a744def 100644 (file)
@@ -196,7 +196,9 @@ class FrontendEditPanel {
                                $cBuf = rtrim(preg_replace('/<[^<]*>$/', '', $cBuf));
                                $secureCount--;
                        }
-                       $content = strlen($cBuf) && $secureCount ? substr($content, 0, strlen($cBuf)) . $icon . substr($content, strlen($cBuf)) : ($content = $icon . $content);
+                       $content = $cBuf !== '' && $secureCount
+                               ? substr($content, 0, strlen($cBuf)) . $icon . substr($content, strlen($cBuf))
+                               : $icon . $content;
                } else {
                        $content .= $icon;
                }
index c3e358c..2b56f36 100644 (file)
@@ -625,17 +625,17 @@ class TemplateParser {
 
                // The following post-processing handles a case when there is only a ViewHelper, and no Object Accessor.
                // Resolves bug #5107.
-               if (strlen($delimiter) === 0 && strlen($viewHelperString) > 0) {
+               if ($delimiter === '' && $viewHelperString !== '') {
                        $viewHelperString = $objectAccessorString . $viewHelperString;
                        $objectAccessorString = '';
                }
 
                // ViewHelpers
                $matches = array();
-               if (strlen($viewHelperString) > 0 && preg_match_all(self::$SPLIT_PATTERN_SHORTHANDSYNTAX_VIEWHELPER, $viewHelperString, $matches, PREG_SET_ORDER) > 0) {
+               if ($viewHelperString !== '' && preg_match_all(self::$SPLIT_PATTERN_SHORTHANDSYNTAX_VIEWHELPER, $viewHelperString, $matches, PREG_SET_ORDER) > 0) {
                        // The last ViewHelper has to be added first for correct chaining.
                        foreach (array_reverse($matches) as $singleMatch) {
-                               if (strlen($singleMatch['ViewHelperArguments']) > 0) {
+                               if ($singleMatch['ViewHelperArguments'] !== '') {
                                        $arguments = $this->postProcessArgumentsForObjectAccessor(
                                                $this->recursiveArrayHandler($singleMatch['ViewHelperArguments'])
                                        );
@@ -648,7 +648,7 @@ class TemplateParser {
                }
 
                // Object Accessor
-               if (strlen($objectAccessorString) > 0) {
+               if ($objectAccessorString !== '') {
 
                        $node = $this->objectManager->get('TYPO3\\CMS\\Fluid\\Core\\Parser\\SyntaxTree\\ObjectAccessorNode', $objectAccessorString);
                        $this->callInterceptor($node, \TYPO3\CMS\Fluid\Core\Parser\InterceptorInterface::INTERCEPT_OBJECTACCESSOR, $state);
index 72d9340..56eed21 100644 (file)
@@ -65,7 +65,11 @@ abstract class AbstractWidgetController extends \TYPO3\CMS\Extbase\Mvc\Controlle
        protected function setViewConfiguration(\TYPO3\CMS\Extbase\Mvc\View\ViewInterface $view) {
                $extbaseFrameworkConfiguration = $this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
                $widgetViewHelperClassName = $this->request->getWidgetContext()->getWidgetViewHelperClassName();
-               if (isset($extbaseFrameworkConfiguration['view']['widget'][$widgetViewHelperClassName]['templateRootPath']) && strlen($extbaseFrameworkConfiguration['view']['widget'][$widgetViewHelperClassName]['templateRootPath']) > 0 && method_exists($view, 'setTemplateRootPath')) {
+               if (
+                       isset($extbaseFrameworkConfiguration['view']['widget'][$widgetViewHelperClassName]['templateRootPath'])
+                       && $extbaseFrameworkConfiguration['view']['widget'][$widgetViewHelperClassName]['templateRootPath'] !== ''
+                       && method_exists($view, 'setTemplateRootPath')
+               ) {
                        $view->setTemplateRootPath(\TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($extbaseFrameworkConfiguration['view']['widget'][$widgetViewHelperClassName]['templateRootPath']));
                }
        }
index cf9f37c..61a823d 100644 (file)
@@ -89,7 +89,7 @@ class PageViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractTagBasedVi
                        ->setArgumentsToBeExcludedFromQueryString($argumentsToBeExcludedFromQueryString)
                        ->setAddQueryStringMethod($addQueryStringMethod)
                        ->build();
-               if (strlen($uri)) {
+               if ((string)$uri !== '') {
                        $this->tag->addAttribute('href', $uri);
                        $this->tag->setContent($this->renderChildren());
                        $result = $this->tag->render();
index 297fa19..02c5e26 100644 (file)
@@ -90,7 +90,7 @@ class TranslateViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewH
        public function render() {
                $id = $this->hasArgument('id') ? $this->arguments['id'] : $this->arguments['key'];
 
-               if (strlen($id) > 0) {
+               if ((string)$id !== '') {
                        return $this->renderTranslation($id);
                } else {
                        throw new \TYPO3\CMS\Fluid\Core\ViewHelper\Exception\InvalidVariableException('An argument "key" or "id" has to be provided', 1351584844);
index a10d813..735cb76 100644 (file)
@@ -48,7 +48,7 @@ class CaseContentObject extends \TYPO3\CMS\Frontend\ContentObject\AbstractConten
                                $this->cObj->data[$this->cObj->currentValKey] = $setCurrent;
                        }
                        $key = isset($conf['key.']) ? $this->cObj->stdWrap($conf['key'], $conf['key.']) : $conf['key'];
-                       $key = strlen($conf[$key]) ? $key : 'default';
+                       $key = $conf[$key] !== '' ? $key : 'default';
                        $name = $conf[$key];
                        $theValue = $this->cObj->cObjGetSingle($name, $conf[$key . '.'], $key);
                        if (isset($conf['stdWrap.'])) {
index 795afc0..5f2649a 100644 (file)
@@ -73,6 +73,7 @@ class ContentContentObject extends \TYPO3\CMS\Frontend\ContentObject\AbstractCon
                        $slideCollectFuzzy = TRUE;
                }
                $again = FALSE;
+               $tmpValue = '';
                do {
                        $res = $this->cObj->exec_getQuery($conf['table'], $conf['select.']);
                        if ($error = $GLOBALS['TYPO3_DB']->sql_error()) {
@@ -135,9 +136,9 @@ class ContentContentObject extends \TYPO3\CMS\Frontend\ContentObject\AbstractCon
                                if (isset($conf['select.']['pidInList.'])) {
                                        unset($conf['select.']['pidInList.']);
                                }
-                               $again = strlen($conf['select.']['pidInList']) ? TRUE : FALSE;
+                               $again = (string)$conf['select.']['pidInList'] !== '';
                        }
-               } while ($again && ($slide && !strlen($tmpValue) && $slideCollectFuzzy || $slide && $slideCollect));
+               } while ($again && $slide && ($tmpValue === '' && $slideCollectFuzzy || $slideCollect));
 
                $wrap = isset($conf['wrap.']) ? $this->cObj->stdWrap($conf['wrap'], $conf['wrap.']) : $conf['wrap'];
                if ($wrap) {
index 36be4ab..bcfabc3 100644 (file)
@@ -2387,7 +2387,7 @@ class ContentObjectRenderer {
         * @return string The processed input value
         */
        public function stdWrap_ifBlank($content = '', $conf = array()) {
-               if (!strlen(trim($content))) {
+               if (trim($content) === '') {
                        $content = $conf['ifBlank'];
                }
                return $content;
@@ -2438,7 +2438,7 @@ class ContentObjectRenderer {
                        $length = isset($conf['strPad.']['length.']) ? $this->stdWrap($conf['strPad.']['length'], $conf['strPad.']['length.']) : $conf['strPad.']['length'];
                        $length = (int)$length;
                }
-               if (isset($conf['strPad.']['padWith']) && strlen($conf['strPad.']['padWith']) > 0) {
+               if (isset($conf['strPad.']['padWith']) && (string)$conf['strPad.']['padWith'] !== '') {
                        $padWith = isset($conf['strPad.']['padWith.']) ? $this->stdWrap($conf['strPad.']['padWith'], $conf['strPad.']['padWith.']) : $conf['strPad.']['padWith'];
                }
                if (!empty($conf['strPad.']['type'])) {
@@ -5741,10 +5741,10 @@ class ContentObjectRenderer {
                                // The '-' character means 'no title'. Necessary in order to specify further parameters without setting the title!
                                $forceTitle = '';
                        }
-                       if (isset($link_paramA[4]) && strlen(trim($link_paramA[4])) > 0) {
-                               $forceParams = trim($link_paramA[4]);
+                       $forceParams = isset($link_paramA[4]) ? trim($link_paramA[4]) : '';
+                       if ($forceParams !== '') {
                                // params value
-                               $conf['additionalParams'] .= $forceParams[0] == '&' ? $forceParams : '&' . $forceParams;
+                               $conf['additionalParams'] .= $forceParams[0] === '&' ? $forceParams : '&' . $forceParams;
                        }
                        // Check, if the target is coded as a JS open window link:
                        $JSwindowParts = array();
@@ -5906,10 +5906,10 @@ class ContentObjectRenderer {
                                                $link_param = $GLOBALS['TSFE']->sys_page->getPageIdFromAlias($link_param);
                                        }
                                        // Link to page even if access is missing?
-                                       if (strlen($conf['linkAccessRestrictedPages'])) {
-                                               $disableGroupAccessCheck = $conf['linkAccessRestrictedPages'] ? TRUE : FALSE;
+                                       if (isset($conf['linkAccessRestrictedPages'])) {
+                                               $disableGroupAccessCheck = (boolean)$conf['linkAccessRestrictedPages'];
                                        } else {
-                                               $disableGroupAccessCheck = $GLOBALS['TSFE']->config['config']['typolinkLinkAccessRestrictedPages'] ? TRUE : FALSE;
+                                               $disableGroupAccessCheck = (boolean)$GLOBALS['TSFE']->config['config']['typolinkLinkAccessRestrictedPages'];
                                        }
                                        // Looking up the page record to verify its existence:
                                        $page = $GLOBALS['TSFE']->sys_page->getPage($link_param, $disableGroupAccessCheck);
@@ -6009,7 +6009,7 @@ class ContentObjectRenderer {
                                                        }
                                                }
                                                // If target page has a different domain and the current domain's linking scheme (e.g. RealURL/...) should not be used
-                                               if (strlen($targetDomain) && $targetDomain !== $currentDomain && !$enableLinksAcrossDomains) {
+                                               if ($targetDomain !== '' && $targetDomain !== $currentDomain && !$enableLinksAcrossDomains) {
                                                        $target = isset($conf['extTarget']) ? $conf['extTarget'] : $GLOBALS['TSFE']->extTarget;
                                                        if ($conf['extTarget.']) {
                                                                $target = $this->stdWrap($target, $conf['extTarget.']);
@@ -6029,7 +6029,7 @@ class ContentObjectRenderer {
                                                                $target = $forceTarget;
                                                        }
                                                        $LD = $GLOBALS['TSFE']->tmpl->linkData($page, $target, $conf['no_cache'], '', '', $addQueryParams, $theTypeP, $targetDomain);
-                                                       if (strlen($targetDomain)) {
+                                                       if ($targetDomain !== '') {
                                                                // We will add domain only if URL does not have it already.
                                                                if ($enableLinksAcrossDomains) {
                                                                        // Get rid of the absRefPrefix if necessary. absRefPrefix is applicable only
index fc6cfb1..064933d 100644 (file)
@@ -384,15 +384,17 @@ class FormContentObject extends \TYPO3\CMS\Frontend\ContentObject\AbstractConten
                                                $value = trim($parts[2]);
                                                // If this form includes an auto responder message, include a HMAC checksum field
                                                // in order to verify potential abuse of this feature.
-                                               if (strlen($value) && GeneralUtility::inList($confData['fieldname'], 'auto_respond_msg')) {
-                                                       $hmacChecksum = GeneralUtility::hmac($value, 'content_form');
-                                                       $hiddenfields .= sprintf('<input type="hidden" name="auto_respond_checksum" id="%sauto_respond_checksum" value="%s" />', $prefix, $hmacChecksum);
-                                               }
-                                               if (strlen($value) && GeneralUtility::inList('recipient_copy,recipient', $confData['fieldname']) && $GLOBALS['TYPO3_CONF_VARS']['FE']['secureFormmail']) {
-                                                       break;
-                                               }
-                                               if (strlen($value) && GeneralUtility::inList('recipient_copy,recipient', $confData['fieldname'])) {
-                                                       $value = $GLOBALS['TSFE']->codeString($value);
+                                               if ($value !== '') {
+                                                       if (GeneralUtility::inList($confData['fieldname'], 'auto_respond_msg')) {
+                                                               $hmacChecksum = GeneralUtility::hmac($value, 'content_form');
+                                                               $hiddenfields .= sprintf('<input type="hidden" name="auto_respond_checksum" id="%sauto_respond_checksum" value="%s" />', $prefix, $hmacChecksum);
+                                                       }
+                                                       if (GeneralUtility::inList('recipient_copy,recipient', $confData['fieldname']) && $GLOBALS['TYPO3_CONF_VARS']['FE']['secureFormmail']) {
+                                                               break;
+                                                       }
+                                                       if (GeneralUtility::inList('recipient_copy,recipient', $confData['fieldname'])) {
+                                                               $value = $GLOBALS['TSFE']->codeString($value);
+                                                       }
                                                }
                                                $hiddenfields .= sprintf('<input type="hidden" name="%s"%s value="%s" />', $confData['fieldname'], $elementIdAttribute, htmlspecialchars($value));
                                                break;
@@ -433,7 +435,7 @@ class FormContentObject extends \TYPO3\CMS\Frontend\ContentObject\AbstractConten
                                }
                                if ($fieldCode) {
                                        // Checking for special evaluation modes:
-                                       if (GeneralUtility::inList('textarea,input,password', $confData['type']) && strlen(trim($parts[3]))) {
+                                       if (trim($parts[3]) !== '' && GeneralUtility::inList('textarea,input,password', $confData['type'])) {
                                                $modeParameters = GeneralUtility::trimExplode(':', $parts[3]);
                                        } else {
                                                $modeParameters = array();
@@ -601,7 +603,7 @@ class FormContentObject extends \TYPO3\CMS\Frontend\ContentObject\AbstractConten
                        foreach ($conf['hiddenFields.'] as $hF_key => $hF_conf) {
                                if (substr($hF_key, -1) != '.') {
                                        $hF_value = $this->cObj->cObjGetSingle($hF_conf, $conf['hiddenFields.'][$hF_key . '.'], 'hiddenfields');
-                                       if (strlen($hF_value) && GeneralUtility::inList('recipient_copy,recipient', $hF_key)) {
+                                       if ((string)$hF_value !== '' && GeneralUtility::inList('recipient_copy,recipient', $hF_key)) {
                                                if ($GLOBALS['TYPO3_CONF_VARS']['FE']['secureFormmail']) {
                                                        continue;
                                                }
index 9895ccc..c1dd825 100644 (file)
@@ -244,15 +244,15 @@ class ImageTextContentObject extends \TYPO3\CMS\Frontend\ContentObject\AbstractC
                                                }
                                        }
                                        // "alt", "title" and "longdesc" attributes:
-                                       if (!strlen($imgConf['altText']) && !is_array($imgConf['altText.'])) {
+                                       if ($imgConf['altText'] === '' && !is_array($imgConf['altText.'])) {
                                                $imgConf['altText'] = $conf['altText'];
                                                $imgConf['altText.'] = $conf['altText.'];
                                        }
-                                       if (!strlen($imgConf['titleText']) && !is_array($imgConf['titleText.'])) {
+                                       if ($imgConf['titleText'] === '' && !is_array($imgConf['titleText.'])) {
                                                $imgConf['titleText'] = $conf['titleText'];
                                                $imgConf['titleText.'] = $conf['titleText.'];
                                        }
-                                       if (!strlen($imgConf['longdescURL']) && !is_array($imgConf['longdescURL.'])) {
+                                       if ($imgConf['longdescURL'] === '' && !is_array($imgConf['longdescURL.'])) {
                                                $imgConf['longdescURL'] = $conf['longdescURL'];
                                                $imgConf['longdescURL.'] = $conf['longdescURL.'];
                                        }
index 403944a..0140a31 100644 (file)
@@ -1345,7 +1345,7 @@ class AbstractMenuContentObject {
                // Added this check: What it does is to enter the baseUrl (if set, which it should for "realurl" based sites)
                // as URL if the calculated value is empty. The problem is that no link is generated with a blank URL
                // and blank URLs might appear when the realurl encoding is used and a link to the frontpage is generated.
-               $list['HREF'] = strlen($LD['totalURL']) ? $LD['totalURL'] : $GLOBALS['TSFE']->baseUrl;
+               $list['HREF'] = (string)$LD['totalURL'] !== '' ? $LD['totalURL'] : $GLOBALS['TSFE']->baseUrl;
                $list['TARGET'] = $LD['target'];
                $list['onClick'] = $onClick;
                return $list;
index 5dcfa51..d8b947a 100644 (file)
@@ -416,7 +416,7 @@ class GraphicalMenuContentObject extends \TYPO3\CMS\Frontend\ContentObject\Menu\
                                        $this->I['linkHREF'] = $this->link($key, $this->I['val']['altTarget'], $this->mconf['forceTypeValue']);
                                        // Title attribute of links:
                                        $titleAttrValue = isset($this->I['val']['ATagTitle.']) ? $this->WMcObj->stdWrap($this->I['val']['ATagTitle'], $this->I['val']['ATagTitle.']) . $this->I['accessKey']['alt'] : $this->I['val']['ATagTitle'] . $this->I['accessKey']['alt'];
-                                       if (strlen($titleAttrValue)) {
+                                       if ($titleAttrValue !== '') {
                                                $this->I['linkHREF']['title'] = $titleAttrValue;
                                        }
                                        // Set rollover
index d535959..494b832 100644 (file)
@@ -99,7 +99,7 @@ class TextMenuContentObject extends \TYPO3\CMS\Frontend\ContentObject\Menu\Abstr
                                $this->I['linkHREF'] = $this->link($key, $this->I['val']['altTarget'], $this->mconf['forceTypeValue']);
                                // Title attribute of links:
                                $titleAttrValue = isset($this->I['val']['ATagTitle.']) ? $this->WMcObj->stdWrap($this->I['val']['ATagTitle'], $this->I['val']['ATagTitle.']) . $this->I['accessKey']['alt'] : $this->I['val']['ATagTitle'] . $this->I['accessKey']['alt'];
-                               if (strlen($titleAttrValue)) {
+                               if ($titleAttrValue !== '') {
                                        $this->I['linkHREF']['title'] = $titleAttrValue;
                                }
 
index b218c64..f15646d 100644 (file)
@@ -251,7 +251,7 @@ class TranslationStatusController extends \TYPO3\CMS\Backend\Module\AbstractFunc
         * @todo Define visibility
         */
        public function getSystemLanguages() {
-               if (!$GLOBALS['BE_USER']->user['admin'] && strlen($GLOBALS['BE_USER']->groupData['allowed_languages'])) {
+               if (!$GLOBALS['BE_USER']->user['admin'] && $GLOBALS['BE_USER']->groupData['allowed_languages'] !== '') {
                        $allowed_languages = array_flip(explode(',', $GLOBALS['BE_USER']->groupData['allowed_languages']));
                }
                $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'sys_language', '1=1' . BackendUtility::deleteClause('sys_language'));
index 8f72e97..dc2886f 100644 (file)
@@ -1939,7 +1939,7 @@ class TypoScriptFrontendController {
                        }
                } elseif (\TYPO3\CMS\Core\Utility\GeneralUtility::isFirstPartOfStr($code, 'REDIRECT:')) {
                        HttpUtility::redirect(substr($code, 9));
-               } elseif (strlen($code)) {
+               } elseif ($code !== '') {
                        // Check if URL is relative
                        $url_parts = parse_url($code);
                        if ($url_parts['host'] == '') {
@@ -2758,7 +2758,7 @@ class TypoScriptFrontendController {
                        // These two fields are the ones which contain recipient addresses that can be misused to send mail from foreign servers.
                        $encodedFields = explode(',', 'recipient, recipient_copy');
                        foreach ($encodedFields as $fieldKey) {
-                               if (strlen($EMAIL_VARS[$fieldKey])) {
+                               if ((string)$EMAIL_VARS[$fieldKey] !== '') {
                                        // Decode...
                                        if ($res = $this->codeString($EMAIL_VARS[$fieldKey], TRUE)) {
                                                $EMAIL_VARS[$fieldKey] = $res;
@@ -2825,7 +2825,7 @@ class TypoScriptFrontendController {
         * @todo Define visibility
         */
        public function checkJumpUrlReferer() {
-               if (strlen($this->jumpurl) && !$this->TYPO3_CONF_VARS['SYS']['doNotCheckReferer']) {
+               if ((string)$this->jumpurl !== '' && !$this->TYPO3_CONF_VARS['SYS']['doNotCheckReferer']) {
                        $referer = parse_url(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('HTTP_REFERER'));
                        if (isset($referer['host']) && !($referer['host'] == GeneralUtility::getIndpEnv('TYPO3_HOST_ONLY'))) {
                                unset($this->jumpurl);
@@ -3216,7 +3216,7 @@ class TypoScriptFrontendController {
                                $lockObj = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Locking\\Locker', $key, $this->TYPO3_CONF_VARS['SYS']['lockingMode']);
                        }
                        $success = FALSE;
-                       if (strlen($key)) {
+                       if ($key !== '') {
                                // TRUE = Page could get locked without blocking
                                // FALSE = Page could get locked but process was blocked before
                                $success = $lockObj->acquire();
@@ -4158,7 +4158,7 @@ if (version == "n3") {
        public function baseUrlWrap($url) {
                if ($this->baseUrl) {
                        $urlParts = parse_url($url);
-                       if (!strlen($urlParts['scheme']) && $url[0] !== '/') {
+                       if ($urlParts['scheme'] === '' && $url[0] !== '/') {
                                $url = $this->baseUrl . $url;
                        }
                }
@@ -4177,7 +4177,7 @@ if (version == "n3") {
         * @todo Define visibility
         */
        public function logDeprecatedTyposcript($typoScriptProperty, $explanation = '') {
-               $explanationText = strlen($explanation) ? ' - ' . $explanation : '';
+               $explanationText = $explanation !== '' ? ' - ' . $explanation : '';
                $GLOBALS['TT']->setTSlogMessage($typoScriptProperty . ' is deprecated.' . $explanationText, 2);
                \TYPO3\CMS\Core\Utility\GeneralUtility::deprecationLog('TypoScript ' . $typoScriptProperty . ' is deprecated' . $explanationText);
        }
@@ -4241,7 +4241,10 @@ if (version == "n3") {
         * @todo Define visibility
         */
        public function prefixLocalAnchorsWithScript() {
-               $scriptPath = $GLOBALS['TSFE']->absRefPrefix . substr(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_REQUEST_URL'), strlen(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL')));
+               $scriptPath = $GLOBALS['TSFE']->absRefPrefix . substr(
+                       \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_REQUEST_URL'),
+                       strlen(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL'))
+               );
                $originalContent = $this->content;
                $this->content = preg_replace('/(<(?:a|area).*?href=")(#[^"]*")/i', '${1}' . htmlspecialchars($scriptPath) . '${2}', $originalContent);
                // There was an error in the call to preg_replace, so keep the original content (behavior prior to PHP 5.2)
@@ -4450,7 +4453,7 @@ if (version == "n3") {
                        $severity = GeneralUtility::SYSLOG_SEVERITY_WARNING;
                }
 
-               if (strlen($reason)) {
+               if ($reason !== '') {
                        $warning = '$TSFE->set_no_cache() was triggered. Reason: ' . $reason . '.';
                } else {
                        $trace = debug_backtrace();
index cb64836..12d1750 100644 (file)
@@ -110,7 +110,7 @@ class PageGenerator {
                if (is_array($GLOBALS['TSFE']->sWordList)) {
                        $space = !empty($GLOBALS['TSFE']->config['config']['sword_standAlone']) ? '[[:space:]]' : '';
                        foreach ($GLOBALS['TSFE']->sWordList as $val) {
-                               if (strlen(trim($val)) > 0) {
+                               if (trim($val) !== '') {
                                        $GLOBALS['TSFE']->sWordRegEx .= $space . quotemeta($val) . $space . '|';
                                }
                        }
@@ -762,7 +762,6 @@ class PageGenerator {
                        $pageRenderer->addFooterData($GLOBALS['TSFE']->cObj->cObjGet($GLOBALS['TSFE']->pSetup['footerData.'], 'footerData.'));
                }
                static::generatePageTitle();
-
                // Add ending slash only to documents rendered as xhtml
                $endingSlash = $GLOBALS['TSFE']->xhtmlVersion ? ' /' : '';
                $pageRenderer->addMetaTag('<meta name="generator" content="TYPO3 ' . TYPO3_branch . ' CMS"' . $endingSlash . '>');
index 1e1d9c5..415d226 100644 (file)
@@ -509,7 +509,7 @@ class AdminPanelView {
                        $table = '';
                        foreach ($tableArr as $key => $arr) {
                                $label = (isset($arr[2]) ? '<strong>' . $arr[0] . '</strong>' : $arr[0]);
-                               $value = strlen($arr[1]) ? $arr[1] : '';
+                               $value = (string)$arr[1] !== '' ? $arr[1] : '';
                                $table .=
                                        '<tr class="typo3-adminPanel-itemRow ' . ($key % 2 == 0 ? 'line-even' : 'line-odd') . '">
                                                        <td class="typo3-adminPanel-section-content-title">' . $label . '</td>
index b5b30bb..ad45d91 100644 (file)
@@ -915,7 +915,7 @@ class SearchController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControlle
                        }
                        // Add media to search in:
                        $additionalMedia = trim($this->settings['mediaList']);
-                       if (strlen($additionalMedia) > 0) {
+                       if ($additionalMedia !== '') {
                                $additionalMedia = GeneralUtility::trimExplode(',', $additionalMedia, TRUE);
                        }
                        foreach ($this->externalParsers as $extension => $obj) {
index 312f5bf..9a86e9d 100644 (file)
@@ -324,7 +324,7 @@ class SearchFormController extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin {
                        $this->join_pages = 1;
                }
                // Add media to search in:
-               if (strlen(trim($this->conf['search.']['mediaList']))) {
+               if (trim($this->conf['search.']['mediaList']) !== '') {
                        $mediaList = implode(',', GeneralUtility::trimExplode(',', $this->conf['search.']['mediaList'], TRUE));
                }
                foreach ($this->external_parsers as $extension => $obj) {
index ddb2729..598c662 100644 (file)
@@ -482,9 +482,10 @@ class FileContentParser {
                                                        $content = \TYPO3\CMS\Core\Utility\GeneralUtility::getUrl($tempFileName);
                                                        unlink($tempFileName);
                                                } else {
+                                                       $content = '';
                                                        $this->pObj->log_setTSlogMessage(sprintf($this->sL('LLL:EXT:indexed_search/locallang.xlf:pdfToolsFailed'), $absFile), 2);
                                                }
-                                               if (strlen($content)) {
+                                               if ((string)$content !== '') {
                                                        $contentArr = $this->pObj->splitRegularContent($this->removeEndJunk($content));
                                                }
                                        }
index 38e3fda..5160f5f 100644 (file)
@@ -903,7 +903,7 @@ class Indexer {
                $urlHeaders = $this->getUrlHeaders($externalUrl);
                if (stristr($urlHeaders['Content-Type'], 'text/html')) {
                        $content = ($this->indexExternalUrl_content = GeneralUtility::getUrl($externalUrl));
-                       if (strlen($content)) {
+                       if ((string)$content !== '') {
                                // Create temporary file:
                                $tmpFile = GeneralUtility::tempnam('EXTERNAL_URL');
                                if ($tmpFile) {
@@ -928,12 +928,12 @@ class Indexer {
        public function getUrlHeaders($url) {
                // Try to get the headers only
                $content = GeneralUtility::getUrl($url, 2);
-               if (strlen($content)) {
+               if ((string)$content !== '') {
                        // Compile headers:
                        $headers = GeneralUtility::trimExplode(LF, $content, TRUE);
                        $retVal = array();
                        foreach ($headers as $line) {
-                               if (!strlen(trim($line))) {
+                               if (trim($line) === '') {
                                        break;
                                }
                                list($headKey, $headValue) = explode(':', $line, 2);
@@ -1271,7 +1271,7 @@ class Indexer {
        public function charsetEntity2utf8(&$contentArr, $charset) {
                // Convert charset if necessary
                foreach ($contentArr as $key => $value) {
-                       if (strlen($contentArr[$key])) {
+                       if ((string)$contentArr[$key] !== '') {
                                if ($charset !== 'utf-8') {
                                        $contentArr[$key] = $this->csObj->utf8_encode($contentArr[$key], $charset);
                                }
@@ -1417,7 +1417,7 @@ class Indexer {
                }
                if ($returnRawMetaphoneValue) {
                        $result = $metaphoneRawValue;
-               } elseif (strlen($metaphoneRawValue)) {
+               } elseif ($metaphoneRawValue !== '') {
                        // Create hash and return integer
                        $result = \TYPO3\CMS\IndexedSearch\Utility\IndexedSearchUtility::md5inthash($metaphoneRawValue);
                } else {
index 0cc72a3..9ca0b8d 100644 (file)
@@ -123,21 +123,21 @@ abstract class AbstractImagePreset extends Configuration\AbstractPreset {
 
                // Add configured im_path on top
                $imPath = $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_path'];
-               if (strlen($imPath) && !in_array($imPath, $searchPaths)) {
+               if ((string)$imPath !== '' && !in_array($imPath, $searchPaths)) {
                        $path = $this->cleanUpPath($imPath);
                        array_unshift($searchPaths, $path);
                }
 
                // Add configured im_path_lzw on top
                $imLzwSearchPath = $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_path_lzw'];
-               if (strlen($imLzwSearchPath) && !in_array($imLzwSearchPath, $searchPaths)) {
+               if ((string)$imLzwSearchPath !== '' && !in_array($imLzwSearchPath, $searchPaths)) {
                        $path = $this->cleanUpPath($imLzwSearchPath);
                        array_unshift($searchPaths, $path);
                }
 
                // Add additional search path from form if given
                if (isset($this->postValues['additionalSearchPath'])
-                       && strlen($this->postValues['additionalSearchPath'])
+                       && (string)$this->postValues['additionalSearchPath'] !== ''
                        && !in_array($this->postValues['additionalSearchPath'], $searchPaths)
                ) {
                        $path = $this->cleanUpPath($this->postValues['additionalSearchPath']);
index c8ff119..0b8500b 100644 (file)
@@ -53,7 +53,7 @@ class ImageFeature extends Configuration\AbstractFeature implements Configuratio
         */
        public function getAdditionalSearchPath() {
                $additionalPath = '';
-               if (isset($this->postValues['additionalSearchPath']) && strlen($this->postValues['additionalSearchPath'])) {
+               if (isset($this->postValues['additionalSearchPath']) && $this->postValues['additionalSearchPath'] !== '') {
                        $additionalPath = $this->postValues['additionalSearchPath'];
                }
                return $additionalPath;
index 0346680..8620432 100644 (file)
@@ -553,7 +553,7 @@ class AbstractController {
                $parameters[] = $controllerParameter;
 
                // Add action if specified
-               if (strlen($action) > 0) {
+               if ((string)$action !== '') {
                        $parameters[] = 'install[action]=' . $action;
                }
 
index 43dffce..127b8f0 100644 (file)
@@ -380,7 +380,7 @@ class DatabaseConnect extends Action\AbstractAction implements StepInterface {
                // connection first and use TCP/IP as fallback
                if ($localConfigurationPathValuePairs['DB/host'] === 'localhost'
                        || \TYPO3\CMS\Core\Utility\GeneralUtility::cmpIP($localConfigurationPathValuePairs['DB/host'], '127.*.*.*')
-                       || strlen($localConfigurationPathValuePairs['DB/host']) === 0
+                       || (string)$localConfigurationPathValuePairs['DB/host'] === ''
                ) {
                        if ($this->isConnectionWithUnixDomainSocketPossible()) {
                                $localConfigurationPathValuePairs['DB/host'] = 'localhost';
@@ -417,15 +417,15 @@ class DatabaseConnect extends Action\AbstractAction implements StepInterface {
        protected function isConnectionWithUnixDomainSocketPossible() {
                $result = FALSE;
                // Use configured socket
-               $socket = $this->getConfiguredSocket();
-               if (!strlen($socket) > 0) {
+               $socket = (string)$this->getConfiguredSocket();
+               if ($socket === '') {
                        // If no configured socket, use default php socket
-                       $defaultSocket = ini_get('mysqli.default_socket');
-                       if (strlen($defaultSocket) > 0) {
+                       $defaultSocket = (string)ini_get('mysqli.default_socket');
+                       if ($defaultSocket !== '') {
                                $socket = $defaultSocket;
                        }
                }
-               if (strlen($socket) > 0) {
+               if ($socket !== '') {
                        $socketOpenResult = @fsockopen('unix://' . $socket);
                        if ($socketOpenResult) {
                                fclose($socketOpenResult);
@@ -637,7 +637,7 @@ class DatabaseConnect extends Action\AbstractAction implements StepInterface {
        protected function getConfiguredPort() {
                $host = isset($GLOBALS['TYPO3_CONF_VARS']['DB']['host']) ? $GLOBALS['TYPO3_CONF_VARS']['DB']['host'] : '';
                $port = isset($GLOBALS['TYPO3_CONF_VARS']['DB']['port']) ? $GLOBALS['TYPO3_CONF_VARS']['DB']['port'] : '';
-               if (strlen($port) === 0 && substr_count($host, ':') === 1) {
+               if ($port === '' && substr_count($host, ':') === 1) {
                        $hostPortArray = explode(':', $host);
                        $port = $hostPortArray[1];
                }
index a20eaa0..b0a2e3e 100644 (file)
@@ -44,7 +44,7 @@ class DatabaseData extends Action\AbstractAction implements StepInterface {
 
                $postValues = $this->postValues['values'];
 
-               $username = strlen($postValues['username']) ? $postValues['username'] : 'admin';
+               $username = (string)$postValues['username'] !== '' ? $postValues['username'] : 'admin';
 
                // Check password and return early if not good enough
                $password = $postValues['password'];
index 26b6e34..02877ea 100644 (file)
@@ -108,7 +108,7 @@ class DatabaseSelect extends Action\AbstractAction implements StepInterface {
        public function needsExecution() {
                $this->initializeDatabaseConnection();
                $result = TRUE;
-               if (strlen($GLOBALS['TYPO3_CONF_VARS']['DB']['database']) > 0) {
+               if ((string)$GLOBALS['TYPO3_CONF_VARS']['DB']['database'] !== '') {
                        $this->databaseConnection->setDatabaseName($GLOBALS['TYPO3_CONF_VARS']['DB']['database']);
                        try {
                                $selectResult = $this->databaseConnection->sql_select_db();
index 7b1ec96..b312678 100644 (file)
@@ -133,7 +133,7 @@ class ImportantActions extends Action\AbstractAction implements Action\ActionInt
         */
        protected function changeSiteName() {
                $values = $this->postValues['values'];
-               if (isset($values['newSiteName']) && strlen($values['newSiteName']) > 0) {
+               if (isset($values['newSiteName']) && $values['newSiteName'] !== '') {
                        /** @var \TYPO3\CMS\Core\Configuration\ConfigurationManager $configurationManager */
                        $configurationManager = $this->objectManager->get('TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager');
                        $configurationManager->setLocalConfigurationValueByPath('SYS/sitename', $values['newSiteName']);
index ed0e321..da1a0cf 100644 (file)
@@ -227,7 +227,7 @@ class StepController extends AbstractController {
                                        }
                                        unset($typo_db_host, $typo_db, $typo_db_username, $typo_db_password, $typo_db_extTableDef_script);
                                } elseif (
-                                       strlen($line) > 0 && preg_match('/^\\/\\/.+|^#.+|^<\\?php$|^<\\?$|^\\?>$/', $line, $matches) === 0
+                                       $line !== '' && preg_match('/^\\/\\/.+|^#.+|^<\\?php$|^<\\?$|^\\?>$/', $line, $matches) === 0
                                ) {
                                        $additionalConfiguration[] = $line;
                                }
index 7e81589..3bbd746 100644 (file)
@@ -235,7 +235,7 @@ abstract class AbstractNode {
                }
                $relativePath = substr($path, strlen($pathSiteWithoutTrailingSlash), strlen($path));
                // Add a forward slash again, so we don't end up with an empty string
-               if (strlen($relativePath) === 0) {
+               if ($relativePath === '') {
                        $relativePath = '/';
                }
                return $relativePath;
index 5002db9..d865b73 100644 (file)
@@ -61,7 +61,7 @@ class LinkNode extends AbstractNode implements NodeInterface {
                }
                $this->name = $structure['name'];
 
-               if (isset($structure['target']) && strlen($structure['target']) > 0) {
+               if (isset($structure['target']) && $structure['target'] !== '') {
                        $this->target = $structure['target'];
                }
        }
index 1c34c57..64a99de 100644 (file)
@@ -408,7 +408,7 @@ class SilentConfigurationUpgradeService {
                catch (\RuntimeException $e) {
                        $currentIm5EffectsValue = $this->configurationManager->getDefaultConfigurationValueByPath('GFX/im_v5effects');
                }
-               if (strlen($currentIm5Value) > 0) {
+               if ((string)$currentIm5Value !== '') {
                        if ($currentImMaskValue != 1) {
                                $changedValues['GFX/im_mask_temp_ext_gif'] = 1;
                        }
index 6c6f4e0..db2948e 100644 (file)
@@ -81,7 +81,7 @@ class SqlSchemaMigrationService {
                                // Ignore comments
                                continue;
                        }
-                       if (!strlen($table)) {
+                       if ($table === '') {
                                $parts = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(' ', $value, TRUE);
                                if (strtoupper($parts[0]) === 'CREATE' && strtoupper($parts[1]) === 'TABLE') {
                                        $table = str_replace('`', '', $parts[2]);
@@ -261,7 +261,7 @@ class SqlSchemaMigrationService {
                $diffArr = array();
                if (is_array($FDsrc)) {
                        foreach ($FDsrc as $table => $info) {
-                               if (!strlen($onlyTableList) || \TYPO3\CMS\Core\Utility\GeneralUtility::inList($onlyTableList, $table)) {
+                               if ($onlyTableList === '' || \TYPO3\CMS\Core\Utility\GeneralUtility::inList($onlyTableList, $table)) {
                                        if (!isset($FDcomp[$table])) {
                                                // If the table was not in the FDcomp-array, the result array is loaded with that table.
                                                $extraArr[$table] = $info;
index 138e678..06e490f 100644 (file)
@@ -378,25 +378,27 @@ class Check {
                        }
                }
 
-               if (strlen($disabledFunctions) > 0 && count($disabledFunctionsArray) > 0) {
-                       $status = new Status\ErrorStatus();
-                       $status->setTitle('Some PHP functions disabled');
-                       $status->setMessage(
-                               'disable_functions=' . implode(' ', explode(',', $disabledFunctions)) . LF .
-                               'These function(s) are disabled. TYPO3 uses some of those, so there might be trouble.' .
-                               ' TYPO3 is designed to use the default set of PHP functions plus some common extensions.' .
-                               ' Possibly these functions are disabled' .
-                               ' due to security considerations and most likely the list would include a function like' .
-                               ' exec() which is used by TYPO3 at various places. Depending on which exact functions' .
-                               ' are disabled, some parts of the system may just break without further notice.'
-                       );
-               } elseif (strlen($disabledFunctions) > 0 && count($disabledFunctionsArray) === 0) {
-                       $status = new Status\NoticeStatus();
-                       $status->setTitle('Some PHP functions currently disabled but OK');
-                       $status->setMessage(
-                               'disable_functions=' . implode(' ', explode(',', $disabledFunctions)) . LF .
-                               'These function(s) are disabled. TYPO3 uses currently none of those, so you are good to go.'
-                       );
+               if ($disabledFunctions !== '') {
+                       if (count($disabledFunctionsArray) > 0) {
+                               $status = new Status\ErrorStatus();
+                               $status->setTitle('Some PHP functions disabled');
+                               $status->setMessage(
+                                       'disable_functions=' . implode(' ', explode(',', $disabledFunctions)) . LF .
+                                       'These function(s) are disabled. TYPO3 uses some of those, so there might be trouble.' .
+                                       ' TYPO3 is designed to use the default set of PHP functions plus some common extensions.' .
+                                       ' Possibly these functions are disabled' .
+                                       ' due to security considerations and most likely the list would include a function like' .
+                                       ' exec() which is used by TYPO3 at various places. Depending on which exact functions' .
+                                       ' are disabled, some parts of the system may just break without further notice.'
+                               );
+                       } else {
+                               $status = new Status\NoticeStatus();
+                               $status->setTitle('Some PHP functions currently disabled but OK');
+                               $status->setMessage(
+                                       'disable_functions=' . implode(' ', explode(',', $disabledFunctions)) . LF .
+                                       'These function(s) are disabled. TYPO3 uses currently none of those, so you are good to go.'
+                               );
+                       }
                } else {
                        $status = new Status\OkStatus();
                        $status->setTitle('No disabled PHP functions');
@@ -439,7 +441,7 @@ class Check {
         */
        protected function checkDocRoot() {
                $docRootSetting = trim(ini_get('doc_root'));
-               if (strlen($docRootSetting) > 0) {
+               if ($docRootSetting !== '') {
                        $status = new Status\NoticeStatus();
                        $status->setTitle('doc_root is set');
                        $status->setMessage(
@@ -464,7 +466,7 @@ class Check {
         */
        protected function checkOpenBaseDir() {
                $openBaseDirSetting = trim(ini_get('open_basedir'));
-               if (strlen($openBaseDirSetting) > 0) {
+               if ($openBaseDirSetting !== '') {
                        $status = new Status\NoticeStatus();
                        $status->setTitle('PHP open_basedir is set');
                        $status->setMessage(
@@ -777,7 +779,7 @@ class Check {
         */
        protected function checkReflectionDocComment() {
                $testReflection = new \ReflectionMethod(get_class($this), __FUNCTION__);
-               if (strlen($testReflection->getDocComment()) === 0) {
+               if ((string)$testReflection->getDocComment() === '') {
                        $status = new Status\ErrorStatus();
                        $status->setTitle('PHP Doc comment reflection broken');
                        $status->setMessage(
index 1ebb9ed..27bbc8c 100644 (file)
@@ -204,40 +204,37 @@ class CompatVersionUpdate extends AbstractUpdate {
        /**
         * Show changes needed
         *
-        * @param string Input prefix to prepend all form fields with.
+        * @param string $inputPrefix Input prefix to prepend all form fields with.
         * @return string HTML output
         */
        protected function showChangesNeeded($inputPrefix = '') {
+               if (!is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['compat_version'])) {
+                       return '';
+               }
                $oldVersion = \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger($GLOBALS['TYPO3_CONF_VARS']['SYS']['compat_version']);
                $currentVersion = \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger(TYPO3_branch);
-               $tableContents = '';
-               if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['compat_version'])) {
-                       $updateWizardBoxes = '';
-                       foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['compat_version'] as $internalName => $details) {
-                               if ($details['version'] > $oldVersion && $details['version'] <= $currentVersion) {
-                                       $description = str_replace(chr(10), '<br />', $details['description']);
-                                       $description_acknowledge = isset($details['description_acknowledge']) ? str_replace(chr(10), '<br />', $details['description_acknowledge']) : '';
-                                       $updateWizardBoxes .= '
-                                               <div style="border: 1px solid; padding: 10px; margin: 10px; padding-top: 0px; width: 500px;">
-                                                       <h3>' . (isset($details['title']) ? $details['title'] : $internalName) . '</h3>
-                                                       ' . $description . (strlen($description_acknowledge) ? '<p>' . $description_acknowledge . '</p>' : '') . (strlen($inputPrefix) ? '
-                                                               <fieldset>
-                                                                       <ol>
-                                                                               <li class="labelAfter">
-                                                                                       <input type="checkbox" name="' . $inputPrefix . '[compatVersion][' . $internalName . ']" id="compatVersion' . $internalName . '" value="1" />
-                                                                                       <label for="compatVersion' . $internalName . '">Acknowledged</label>
-                                                                               </li>
-                                                                       </ol>
-                                                               </fieldset>
-                                                       ' : '') . '
-                                               </div>';
-                               }
+               $updateWizardBoxes = '';
+               foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['compat_version'] as $internalName => $details) {
+                       if ($details['version'] > $oldVersion && $details['version'] <= $currentVersion) {
+                               $description = str_replace(chr(10), '<br />', $details['description']);
+                               $description_acknowledge = isset($details['description_acknowledge']) ? str_replace(chr(10), '<br />', $details['description_acknowledge']) : '';
+                               $updateWizardBoxes .= '
+                                       <div style="border: 1px solid; padding: 10px; margin: 10px; padding-top: 0px; width: 500px;">
+                                               <h3>' . (isset($details['title']) ? $details['title'] : $internalName) . '</h3>
+                                               ' . $description . ($description_acknowledge !== '' ? '<p>' . $description_acknowledge . '</p>' : '') . ($inputPrefix !== '' ? '
+                                                       <fieldset>
+                                                               <ol>
+                                                                       <li class="labelAfter">
+                                                                               <input type="checkbox" name="' . $inputPrefix . '[compatVersion][' . $internalName . ']" id="compatVersion' . $internalName . '" value="1" />
+                                                                               <label for="compatVersion' . $internalName . '">Acknowledged</label>
+                                                                       </li>
+                                                               </ol>
+                                                       </fieldset>
+                                               ' : '') . '
+                                       </div>';
                        }
                }
-               if (strlen($updateWizardBoxes)) {
-                       return $updateWizardBoxes;
-               }
-               return '';
+               return $updateWizardBoxes;
        }
 
 }
index 7858da2..cde98ba 100644 (file)
@@ -213,7 +213,7 @@ class Ter extends \TYPO3\CMS\Extensionmanager\Utility\Connection\TerUtility {
                                                \TYPO3\CMS\Core\Utility\GeneralUtility::mkdir_deep($path, implode('/', $zipEntryPathSegments));
                                        } else {
                                                $absoluteTargetPath = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($path . implode('/', $zipEntryPathSegments) . '/' . $fileName);
-                                               if (strlen(trim($absoluteTargetPath)) > 0) {
+                                               if (trim($absoluteTargetPath) !== '') {
                                                        $return = \TYPO3\CMS\Core\Utility\GeneralUtility::writeFile(
                                                                $absoluteTargetPath, zip_entry_read($zipEntry, zip_entry_filesize($zipEntry))
                                                        );
index 78b819b..75dc52e 100644 (file)
@@ -236,7 +236,7 @@ class LinkAnalyzer {
                        $conf = $GLOBALS['TCA'][$table]['columns'][$field]['config'];
                        $valueField = $record[$field];
                        // Check if a TCA configured field has soft references defined (see TYPO3 Core API document)
-                       if ($conf['softref'] && strlen($valueField)) {
+                       if ($conf['softref'] && (string)$valueField !== '') {
                                // Explode the list of soft references/parameters
                                $softRefs = BackendUtility::explodeSoftRefParserList($conf['softref']);
                                // Traverse soft references
index 9405d1d..604422a 100644 (file)
@@ -156,7 +156,7 @@ class ArrayBrowser {
         */
        public function wrapValue($theValue, $depth) {
                $wrappedValue = '';
-               if (strlen($theValue) > 0) {
+               if ((string)$theValue !== '') {
                        $wrappedValue = '<strong>' . htmlspecialchars($theValue) . '</strong>';
                }
                return $wrappedValue;
index 1beba91..b0fd0e8 100644 (file)
@@ -2187,7 +2187,7 @@ class ElementBrowser {
                        }
                        $str = is_object($fileObject) ? $fileObject->getIdentifier() : '';
                }
-               if (strlen($str)) {
+               if ($str !== '') {
                        return '
                                <!-- Print current URL -->
                                <table border="0" cellpadding="0" cellspacing="0" id="typo3-curUrl">
index f2ad395..23fc908 100644 (file)
@@ -318,7 +318,7 @@ class RecordList {
                // It is set, if the clickmenu-layer is active AND the extended view is not enabled.
                $dblist->dontShowClipControlPanels = $GLOBALS['CLIENT']['FORMSTYLE'] && !$this->MOD_SETTINGS['bigControlPanel'] && $dblist->clipObj->current == 'normal' && !$this->modTSconfig['properties']['showClipControlPanelsDespiteOfCMlayers'];
                // If there is access to the page or root page is used for searching, then render the list contents and set up the document template object:
-               if ($access || ($this->id === 0 && $this->search_levels > 0 && strlen($this->search_field) > 0)) {
+               if ($access || ($this->id === 0 && $this->search_levels > 0 && $this->search_field !== '')) {
                        // Deleting records...:
                        // Has not to do with the clipboard but is simply the delete action. The clipboard object is used to clean up the submitted entries to only the selected table.
                        if ($this->cmd == 'delete') {
index 8d6506c..3662c5a 100644 (file)
@@ -182,7 +182,7 @@ class DatabaseRecordList extends \TYPO3\CMS\Recordlist\RecordList\AbstractDataba
                // Get users permissions for this page record:
                $localCalcPerms = $GLOBALS['BE_USER']->calcPerms($this->pageRow);
                // CSH
-               if (!strlen($this->id)) {
+               if ((string)$this->id === '') {
                        $buttons['csh'] = BackendUtility::cshItem('xMOD_csh_corebe', 'list_module_noId', $GLOBALS['BACK_PATH'], '', TRUE);
                } elseif (!$this->id) {
                        $buttons['csh'] = BackendUtility::cshItem('xMOD_csh_corebe', 'list_module_root', $GLOBALS['BACK_PATH'], '', TRUE);
@@ -605,7 +605,7 @@ class DatabaseRecordList extends \TYPO3\CMS\Recordlist\RecordList\AbstractDataba
        public function renderListRow($table, $row, $cc, $titleCol, $thumbsCol, $indent = 0) {
                $iOut = '';
                // If in search mode, make sure the preview will show the correct page
-               if (strlen($this->searchString)) {
+               if ((string)$this->searchString !== '') {
                        $id_orig = $this->id;
                        $this->id = $row['pid'];
                }
@@ -688,7 +688,7 @@ class DatabaseRecordList extends \TYPO3\CMS\Recordlist\RecordList\AbstractDataba
                                }
                        }
                        // Reset the ID if it was overwritten
-                       if (strlen($this->searchString)) {
+                       if ((string)$this->searchString !== '') {
                                $this->id = $id_orig;
                        }
                        // Add row to CSV list:
index 5ebb151..2ed5c8b 100644 (file)
@@ -89,7 +89,7 @@ class RecyclerUtility {
                $output = ($fullOutput = '/');
                while ($uid != 0 && $loopCheck > 0) {
                        $loopCheck--;
-                       $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid,pid,title,deleted,t3ver_oid,t3ver_wsid', 'pages', 'uid=' . (int)$uid . (strlen(trim($clause)) ? ' AND ' . $clause : ''));
+                       $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid,pid,title,deleted,t3ver_oid,t3ver_wsid', 'pages', 'uid=' . (int)$uid . (trim($clause) !== '' ? ' AND ' . $clause : ''));
                        if (is_resource($res)) {
                                $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
                                $GLOBALS['TYPO3_DB']->sql_free_result($res);
index 5cf4263..3da86cf 100644 (file)
@@ -487,7 +487,7 @@ var selectedDictionary = "' . $this->dictionary . '";
         * @todo Define visibility
         */
        public function startHandler($xml_parser, $tag, $attributes) {
-               if (strlen($this->xmlCharacterData)) {
+               if ((string)$this->xmlCharacterData !== '') {
                        $this->spellCheckHandler($xml_parser, $this->xmlCharacterData);
                        $this->xmlCharacterData = '';
                }
@@ -528,7 +528,7 @@ var selectedDictionary = "' . $this->dictionary . '";
         * @todo Define visibility
         */
        public function endHandler($xml_parser, $tag) {
-               if (strlen($this->xmlCharacterData)) {
+               if ((string)$this->xmlCharacterData !== '') {
                        $this->spellCheckHandler($xml_parser, $this->xmlCharacterData);
                        $this->xmlCharacterData = '';
                }
index d5ffd9c..be2ebff 100644 (file)
@@ -195,7 +195,7 @@ class NormalizeCommand {
                        }
                        $fieldValues = implode(',', $fieldArray);
                }
-               if (strlen($fieldValues) === 0) {
+               if ((string)$fieldValues === '') {
                        throw new \InvalidArgumentException('Unable to convert integer field to list of values: Result list empty.', 1291422012);
                }
                if ((string) $fieldValues !== '*') {
@@ -221,7 +221,7 @@ class NormalizeCommand {
         * @return array
         */
        static protected function convertRangeToListOfValues($range) {
-               if (strlen($range) === 0) {
+               if ((string)$range === '') {
                        throw new \InvalidArgumentException('Unable to convert range to list of values with empty string.', 1291234985);
                }
                $rangeArray = explode('-', $range);
@@ -232,7 +232,7 @@ class NormalizeCommand {
                        }
                        $rangeArray[$fieldNumber] = (int)$fieldValue;
                }
-               $resultList = '';
+
                if (count($rangeArray) === 1) {
                        $resultList = $rangeArray[0];
                } elseif (count($rangeArray) === 2) {
@@ -263,7 +263,7 @@ class NormalizeCommand {
         * @return string Comma separated list of valid values
         */
        static protected function reduceListOfValuesByStepValue($stepExpression) {
-               if (strlen($stepExpression) === 0) {
+               if ($stepExpression === '') {
                        throw new \InvalidArgumentException('Unable to convert step values.', 1291234987);
                }
                $stepValuesAndStepArray = explode('/', $stepExpression);
@@ -272,10 +272,10 @@ class NormalizeCommand {
                }
                $left = $stepValuesAndStepArray[0];
                $right = $stepValuesAndStepArray[1];
-               if (strlen($stepValuesAndStepArray[0]) === 0) {
+               if ((string)$stepValuesAndStepArray[0] === '') {
                        throw new \InvalidArgumentException('Unable to convert step values: Left part of / is empty.', 1291414955);
                }
-               if (strlen($stepValuesAndStepArray[1]) === 0) {
+               if ((string)$stepValuesAndStepArray[1] === '') {
                        throw new \InvalidArgumentException('Unable to convert step values: Right part of / is empty.', 1291414956);
                }
                if (!MathUtility::canBeInterpretedAsInteger($right)) {
index a947e27..38abbe7 100644 (file)
@@ -359,7 +359,7 @@ abstract class AbstractTask {
                );
                $res = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryArr);
                if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
-                       if (strlen($row['serialized_executions']) > 0) {
+                       if ($row['serialized_executions'] !== '') {
                                $isRunning = TRUE;
                        }
                }
@@ -383,7 +383,7 @@ abstract class AbstractTask {
                $res = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryArr);
                $runningExecutions = array();
                if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
-                       if (strlen($row['serialized_executions']) > 0) {
+                       if ($row['serialized_executions'] !== '') {
                                $runningExecutions = unserialize($row['serialized_executions']);
                        }
                }
@@ -422,7 +422,7 @@ abstract class AbstractTask {
                );
                $res = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryArr);
                if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
-                       if (strlen($row['serialized_executions']) > 0) {
+                       if ($row['serialized_executions'] !== '') {
                                $runningExecutions = unserialize($row['serialized_executions']);
                                // Remove the selected execution
                                unset($runningExecutions[$executionID]);
index 1be5597..26b76d1 100644 (file)
@@ -211,7 +211,7 @@ class SetupModuleController {
                                                GeneralUtility::callUserFunction($function, $params, $this);
                                        }
                                }
-                               $this->passwordIsSubmitted = strlen($be_user_data['password']) > 0;
+                               $this->passwordIsSubmitted = (string)$be_user_data['password'] !== '';
                                $passwordIsConfirmed = $this->passwordIsSubmitted && $be_user_data['password'] === $be_user_data['password2'];
                                // Update the real name:
                                if ($be_user_data['realName'] !== $GLOBALS['BE_USER']->user['realName']) {
index 3c7b019..d5cc98e 100644 (file)
@@ -563,7 +563,7 @@ class DataHandlerHook {
                        }
                        if ($table === 'be_users' || $noTablePrefix) {
                                if ($userRecord = BackendUtility::getRecord('be_users', $id, 'uid,email,lang,realName', BackendUtility::BEenableFields('be_users'))) {
-                                       if (strlen(trim($userRecord['email']))) {
+                                       if (trim($userRecord['email']) !== '') {
                                                $emails[$id] = $userRecord;
                                        }
                                }
index 08e8fa7..7996edd 100644 (file)
@@ -58,7 +58,7 @@ class ReviewController extends \TYPO3\CMS\Workspaces\Controller\AbstractControll
                        $wsCur = array($activeWorkspace => TRUE);
                        $wsList = array_intersect_key($wsList, $wsCur);
                } else {
-                       if (strlen(GeneralUtility::_GP('workspace'))) {
+                       if ((string)GeneralUtility::_GP('workspace') !== '') {
                                $switchWs = (int)GeneralUtility::_GP('workspace');
                                if (in_array($switchWs, array_keys($wsList)) && $activeWorkspace != $switchWs) {
                                        $activeWorkspace = $switchWs;