[CLEANUP] Replace strlen() with === for zero length check 94/27794/10
authorMarkus Klein <klein.t3@reelworx.at>
Sun, 23 Feb 2014 10:21:20 +0000 (11:21 +0100)
committerStefan Neufeind <typo3.neufeind@speedpartner.de>
Sun, 18 Jan 2015 13:37:46 +0000 (14:37 +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.

Change-Id: I888d70e42f925bd57ad23b873b72d6a38acb39ef
Resolves: #54091
Releases: master
Reviewed-on: http://review.typo3.org/27794
Reviewed-by: Mathias Schreiber <mathias.schreiber@wmdb.de>
Tested-by: Mathias Schreiber <mathias.schreiber@wmdb.de>
Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Tested-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
107 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/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/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/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/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/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/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/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/lang/Classes/Service/TerService.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 6046f27..0577f81 100644 (file)
@@ -44,9 +44,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(
@@ -68,7 +72,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 bff3bde..1ee472c 100644 (file)
@@ -1296,7 +1296,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 beb4851..c18c948 100644 (file)
@@ -269,7 +269,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 68e0d94..229970d 100644 (file)
@@ -443,7 +443,7 @@ class FormsController extends AbstractWizardController {
                                                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;
@@ -662,7 +662,7 @@ class FormsController extends AbstractWizardController {
                                                        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'];
@@ -676,7 +676,7 @@ class FormsController extends AbstractWizardController {
                                                        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 6988305..cc50e57 100644 (file)
@@ -213,7 +213,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
@@ -239,7 +239,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 7e9fcff..e186133 100644 (file)
@@ -75,7 +75,7 @@ class TreeElement extends AbstractFormElement {
                                        $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 1481cbb..21cbcbb 100644 (file)
@@ -683,14 +683,14 @@ abstract class AbstractTreeView {
         * @return string The title.
         */
        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 4171125..241901a 100644 (file)
@@ -2722,11 +2722,11 @@ class BackendUtility {
                $beUser = static::getBackendUserAuthentication();
                $viewLanguageOrder = $beUser->getTSConfigVal('options.view.languageOrder');
 
-               if (strlen($viewLanguageOrder) > 0) {
+               if ((string)$viewLanguageOrder !== '') {
                        $suffix = '';
                        // Find allowed languages (if none, all are allowed!)
                        $allowedLanguages = NULL;
-                       if (!$beUser->user['admin'] && strlen($beUser->groupData['allowed_languages'])) {
+                       if (!$beUser->user['admin'] && $beUser->groupData['allowed_languages'] !== '') {
                                $allowedLanguages = array_flip(explode(',', $beUser->groupData['allowed_languages']));
                        }
                        // Traverse the view order, match first occurrence:
@@ -3691,7 +3691,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 7bd3696..f78c1bd 100644 (file)
@@ -635,7 +635,7 @@ class PageLayoutView extends \TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRe
                                                        ) {
                                                                $grid .= $this->tt_content_drawColHeader($this->getLanguageService()->sL($columnConfig['name']) .
                                                                        ' (' . $this->getLanguageService()->getLL('noAccess') . ')', '', '');
-                                                       } elseif (isset($columnConfig['name']) && strlen($columnConfig['name']) > 0) {
+                                                       } elseif (isset($columnConfig['name']) && $columnConfig['name'] !== '') {
                                                                $grid .= $this->tt_content_drawColHeader($this->getLanguageService()->sL($columnConfig['name'])
                                                                        . ' (' . $this->getLanguageService()->getLL('notAssigned') . ')', '', '');
                                                        } else {
@@ -1813,7 +1813,7 @@ class PageLayoutView extends \TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRe
                        // Remove disallowed languages
                        if (count($langSelItems) > 1
                                && !$this->getBackendUser()->user['admin']
-                               && strlen($this->getBackendUser()->groupData['allowed_languages'])
+                               && $this->getBackendUser()->groupData['allowed_languages'] !== ''
                        ) {
                                $allowed_languages = array_flip(explode(',', $this->getBackendUser()->groupData['allowed_languages']));
                                if (count($allowed_languages)) {
index 6041114..c4fb66b 100644 (file)
@@ -1159,8 +1159,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 e512ab9..72791c5 100644 (file)
@@ -143,7 +143,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);
@@ -320,7 +320,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 664f688..0b09a4b 100644 (file)
@@ -178,7 +178,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 ac1335e..77692c5 100644 (file)
@@ -1670,11 +1670,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);
                                }
                        }
@@ -1868,7 +1868,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];
@@ -1932,7 +1932,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)) {
@@ -2045,7 +2045,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)) {
@@ -2055,7 +2055,7 @@ class CharsetConverter {
                                $n++;
                        }
                }
-               if (!strlen($str[$i])) {
+               if (!isset($str[$i])) {
                        // Offset beyond string length
                        return FALSE;
                }
@@ -2092,7 +2092,7 @@ class CharsetConverter {
                                $n++;
                        }
                }
-               if (!strlen($str[$i])) {
+               if (!isset($str[$i])) {
                        // Offset beyond string length
                        return FALSE;
                }
@@ -2123,7 +2123,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)) {
@@ -2168,7 +2168,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) {
@@ -2180,7 +2180,7 @@ class CharsetConverter {
                                }
                        }
                }
-               if (!strlen($str[$i])) {
+               if (!isset($str[$i])) {
                        return $str;
                }
                // string shorter than supplied length
@@ -2232,7 +2232,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) {
@@ -2269,7 +2269,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) {
@@ -2282,7 +2282,7 @@ class CharsetConverter {
                        }
                        $n++;
                }
-               if (!strlen($str[$i])) {
+               if (!isset($str[$i])) {
                        return FALSE;
                }
                // offset beyond string length
@@ -2323,7 +2323,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 fe7a5bf..5b61afd 100644 (file)
@@ -472,7 +472,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 50ce417..d7b1508 100644 (file)
@@ -2339,7 +2339,7 @@ class DataHandler {
                        }
                        $this->databaseConnection->sql_free_result($res);
                        // If the new value is there:
-                       $value = strlen($newValue) ? $newValue : $value;
+                       $value = $newValue !== '' ? $newValue : $value;
                }
                return $value;
        }
@@ -3437,7 +3437,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) || $this->getInlineFieldType($dsConf) !== FALSE) && strlen($dataValue)) {
+               if (($this->isReferenceField($dsConf) || $this->getInlineFieldType($dsConf) !== FALSE) && (string)$dataValue !== '') {
                        $dataValue = $this->copyRecord_procBasedOnFieldType($table, $uid, $field, $dataValue, array(), $dsConf, $realDestPid);
                        $this->registerDBList[$table][$uid][$field] = 'FlexForm_reference';
                }
@@ -3988,15 +3988,17 @@ 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']) && !empty($TSConfig['translateToMessage'])) {
+                                                                                                       if (!empty($TSConfig['translateToMessage'])) {
                                                                                                                $translateToMsg = $GLOBALS['LANG'] ? $GLOBALS['LANG']->sL($TSConfig['translateToMessage']) : $TSConfig['translateToMessage'];
                                                                                                                $translateToMsg = @sprintf($translateToMsg, $langRec['title']);
                                                                                                        }
                                                                                                        if (!strlen($translateToMsg)) {
                                                                                                                $translateToMsg = 'Translate to ' . $langRec['title'] . ':';
+                                                                                                       } else {
+                                                                                                               $translateToMsg = @sprintf($TSConfig['translateToMessage'], $langRec['title']);
                                                                                                        }
                                                                                                        $overrideValues[$fN] = '[' . $translateToMsg . '] ' . $row[$fN];
                                                                                                }
@@ -4981,7 +4983,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 86c89cd..6bb9534 100644 (file)
@@ -817,7 +817,7 @@ class QueryGenerator {
                                                                }
                                                        } else {
                                                                $singleValue = $row[$fieldName];
-                                                               if (strlen($singleValue) && !stristr($singleValue, '_')) {
+                                                               if ($singleValue !== '' && !stristr($singleValue, '_')) {
                                                                        $dontPrefixFirstTable = 1;
                                                                }
                                                        }
index a83c721..c597f19 100644 (file)
@@ -828,7 +828,7 @@ class QueryView {
                                                                }
                                                        } else {
                                                                $singleValue = $row[$fieldName];
-                                                               if (strlen($singleValue) && !stristr($singleValue, '_')) {
+                                                               if ($singleValue !== '' && !stristr($singleValue, '_')) {
                                                                        $dontPrefixFirstTable = 1;
                                                                }
                                                        }
index ce0758e..14e3c83 100644 (file)
@@ -401,7 +401,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);
@@ -409,7 +409,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'];
                                                                }
                                                        }
@@ -471,7 +471,7 @@ class ReferenceIndex {
                        $this->temp_flexRelations['db'][$structurePath] = $resultsFromDatabase;
                }
                // Soft References:
-               if ((is_array($dataValue) || strlen($dataValue)) && $softRefs = BackendUtility::explodeSoftRefParserList($dsConf['softref'])) {
+               if ((is_array($dataValue) || (string)$dataValue !== '') && $softRefs = BackendUtility::explodeSoftRefParserList($dsConf['softref'])) {
                        $softRefValue = $dataValue;
                        foreach ($softRefs as $spKey => $spParams) {
                                $softRefObj = BackendUtility::softRefParserObj($spKey);
@@ -479,7 +479,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 9dede78..b9d0b5b 100644 (file)
@@ -27,7 +27,7 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
  *
  * Example of usage
  * Soft References:
- * if ($conf['softref'] && strlen($value))     {       // Check if a TCA configured field has softreferences defined (see TYPO3 Core API document)
+ * if ($conf['softref'] && (strong)$value !== ''))     {       // Check if a TCA configured field has softreferences defined (see TYPO3 Core API document)
  * $softRefs = \TYPO3\CMS\Backend\Utility\BackendUtility::explodeSoftRefParserList($conf['softref']);          // Explode the list of softreferences/parameters
  * foreach($softRefs as $spKey => $spParams)   {       // Traverse soft references
  * $softRefObj = &\TYPO3\CMS\Backend\Utility\BackendUtility::softRefParserObj($spKey); // create / get object
@@ -631,7 +631,7 @@ class SoftReferenceIndex {
                        // Link-data del
                        $link_param = trim($link_params_parts[0]);
 
-                       if (strlen($link_params_parts[1])) {
+                       if ((string)$link_params_parts[1] !== '') {
                                $finalTagParts['anchor'] = trim($link_params_parts[1]);
                        }
 
@@ -643,7 +643,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);
@@ -744,11 +744,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:
@@ -780,7 +780,7 @@ class SoftReferenceIndex {
                                }
                }
                // Finally, for all entries that was rebuild with tokens, add target, class, title and additionalParams in the end:
-               if (strlen($content) && isset($tLP['target']) && $tLP['target'] !== '') {
+               if ($content !== '' && isset($tLP['target']) && $tLP['target'] !== '') {
                        $content .= ' ' . $tLP['target'];
                        if (isset($tLP['class']) && $tLP['class'] !== '') {
                                $content .= ' "' . $tLP['class'] . '"';
index 5b2b2d5..510f4dd 100644 (file)
@@ -431,7 +431,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 = $this->normalizeKeyword($key);
@@ -683,7 +683,7 @@ class SqlParser {
        public function parseFieldList(&$parseString, $stopRegex = '') {
                $stack = array();
                // Contains the parsed content
-               if (strlen($parseString) === 0) {
+               if ($parseString === '') {
                        return $stack;
                }
                // @todo - should never happen, why does it?
@@ -700,7 +700,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) {
@@ -784,7 +784,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:
@@ -856,7 +856,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:
@@ -935,7 +935,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:
@@ -973,7 +973,7 @@ class SqlParser {
                // Recursivity brake.
                $loopExit = 0;
                // $parseString is continuously shortened 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:
@@ -1102,7 +1102,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;
@@ -1120,7 +1120,7 @@ class SqlParser {
                                                }
                                        }
                                        $stack[$level][$pnt[$level]]['comparator'] = $this->nextPart($parseString, '^(' . implode('|', self::$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(
@@ -1208,7 +1208,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 = $this->normalizeKeyword($this->lastStopKeyWord);
@@ -1405,7 +1405,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));
@@ -1528,10 +1528,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 {
                }
                // Make query:
                $query = 'UPDATE ' . $components['TABLE'] . ' SET ' . implode(',', $fields) .
-                       (strlen($where) ? ' WHERE ' . $where : '');
+                       ($where !== '' ? ' WHERE ' . $where : '');
 
                return $query;
        }
@@ -1602,7 +1602,7 @@ class SqlParser {
                // Where clause:
                $where = $this->compileWhereClause($components['WHERE']);
                // Make query:
-               $query = 'DELETE FROM ' . $components['TABLE'] . (strlen($where) ? ' WHERE ' . $where : '');
+               $query = 'DELETE FROM ' . $components['TABLE'] . ($where !== '' ? ' WHERE ' . $where : '');
 
                return $query;
        }
@@ -1911,7 +1911,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 536073f..c3bce42 100644 (file)
@@ -147,7 +147,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 83a9ddd..dce780c 100644 (file)
@@ -800,10 +800,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'] !== '') {
@@ -1082,7 +1082,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 342e8f9..b9329dc 100644 (file)
@@ -1642,7 +1642,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 5df93e5..f8f7fa3 100644 (file)
@@ -847,7 +847,11 @@ class GraphicalFunctions {
         * @see makeText(), calcTextCordsForMap()
         */
        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']) . '" />';
        }
 
        /**
@@ -1079,14 +1083,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)) {
@@ -1110,7 +1114,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) {
@@ -1144,7 +1148,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'],
@@ -1164,7 +1168,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 b4ce301..4f7b6fa 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 9e8d3b2..be006c7 100644 (file)
@@ -487,7 +487,7 @@ class PageRenderer implements \TYPO3\CMS\Core\SingletonInterface {
                $this->reset();
                $this->csConvObj = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Charset\CharsetConverter::class);
                $this->locales = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Localization\Locales::class);
-               if (strlen($templateFile)) {
+               if ($templateFile !== '') {
                        $this->templateFile = $templateFile;
                }
                $this->backPath = isset($backPath) ? $backPath : $GLOBALS['BACK_PATH'];
index 908b75c..181e5f3 100644 (file)
@@ -149,7 +149,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 3da2d62..7a32a4e 100644 (file)
@@ -64,7 +64,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 c6c09c2..cc9745f 100644 (file)
@@ -202,7 +202,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;
@@ -420,7 +420,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 . '.'])) {
@@ -442,7 +442,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 d9fd6a7..24a8349 100644 (file)
@@ -1237,7 +1237,7 @@ class TypoScriptParser {
                        } 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 4fbfd98..2067b6d 100644 (file)
@@ -464,7 +464,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 ($relativePosition !== '') {
                        // Insert at specified position
                        $matchedPosition = ArrayUtility::filterByValueRecursive($relativeToField, $GLOBALS['TCA'][$table]['columns'][$field]['config']['items']);
                        if (count($matchedPosition) > 0) {
@@ -763,7 +763,7 @@ class ExtensionManagementUtility {
                }
                ArrayUtility::mergeRecursiveWithOverrule($defaultModuleConfiguration, $moduleConfiguration);
                $moduleConfiguration = $defaultModuleConfiguration;
-               if (strlen($subModuleName) > 0) {
+               if ($subModuleName !== '') {
                        $moduleSignature = $mainModuleName . '_' . $subModuleName;
                } else {
                        $moduleSignature = $mainModuleName;
index 32929a7..36367ab 100755 (executable)
@@ -951,7 +951,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);
@@ -1641,7 +1641,7 @@ class GeneralUtility {
                } else {
                        $p = explode('&', $string);
                        foreach ($p as $v) {
-                               if (strlen($v)) {
+                               if ($v !== '') {
                                        list($pK, $pV) = explode('=', $v, 2);
                                        $output[rawurldecode($pK)] = rawurldecode($pV);
                                }
@@ -2251,7 +2251,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 ((string)$val['attributes']['index'] !== '') {
                                $tagName = $val['attributes']['index'];
                        }
                        // Setting tag-values, manage stack:
@@ -2546,7 +2546,7 @@ Connection: close
                                        }
                                }
                                $content .= $line;
-                               if (!strlen(trim($line))) {
+                               if (trim($line) === '') {
                                        // Stop at the first empty line (= end of header)
                                        break;
                                }
@@ -2687,7 +2687,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']);
@@ -2810,7 +2810,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);
@@ -3017,7 +3017,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 aca5ebf..2dc3e33 100644 (file)
@@ -126,7 +126,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 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 f34bcea..123172d 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 4855857..c79f802 100644 (file)
@@ -522,7 +522,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])) {
@@ -675,7 +675,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])) {
@@ -1158,7 +1158,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) : '');
                                }
@@ -1175,7 +1175,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) {
@@ -1203,7 +1203,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;
                        }
@@ -3091,7 +3091,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'] . ((string)$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;
@@ -3722,7 +3722,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 5cb0845..6dde6be 100644 (file)
@@ -367,7 +367,7 @@ class SqlParser extends \TYPO3\CMS\Core\Database\SqlParser {
                                $type = $this->databaseConnection->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 9698a37..0553d81 100644 (file)
@@ -286,7 +286,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 0209b3f..1fb3e65 100644 (file)
@@ -216,7 +216,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 fef03af..a74a248 100644 (file)
@@ -105,7 +105,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);
@@ -154,7 +154,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();
@@ -233,7 +233,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 5c254e7..42f9f27 100644 (file)
@@ -76,10 +76,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 970901b..fe24cc8 100644 (file)
@@ -286,7 +286,7 @@ class ActionController extends AbstractController {
 
                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);
index b8e9dd1..e771590 100644 (file)
@@ -103,8 +103,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 = TypeHandlingUtility::normalizeType($dataType);
index 8e59bd3..1c58248 100644 (file)
@@ -215,7 +215,7 @@ class CommandController implements CommandControllerInterface {
                $originalRole = $this->ensureAdminRoleIfRequested();
                $commandResult = call_user_func_array(array($this, $this->commandMethodName), $preparedArguments);
                $this->restoreUserRole($originalRole);
-               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 e69a5b7..ae75044 100644 (file)
@@ -368,7 +368,7 @@ class Request implements 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 e199d92..916eade 100644 (file)
@@ -144,7 +144,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);
@@ -167,8 +167,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 MvcException('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;
@@ -200,8 +200,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 MvcException('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 c743ef4..9c6d40c 100644 (file)
@@ -97,10 +97,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 1eec262..753ac85 100644 (file)
@@ -536,7 +536,7 @@ class DataMapper implements \TYPO3\CMS\Core\SingletonInterface {
         * @return DataMap The data map
         */
        public function getDataMap($className) {
-               if (!is_string($className) || strlen($className) === 0) {
+               if (!is_string($className) || $className === '') {
                        throw new Persistence\Generic\Exception('No class name was given to retrieve the Data Map for.', 1251315965);
                }
                if (!isset($this->dataMaps[$className])) {
index 48e87ad..bf3164c 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 6c286ab..77d13e9 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 5ca5028..1cfe78c 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 50b3273..81adeed 100644 (file)
@@ -42,7 +42,7 @@ class DocCommentParser {
                $this->tags = array();
                $lines = explode(LF, $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) . LF;
index b783ccd..f6a2586 100644 (file)
@@ -231,10 +231,10 @@ class FieldProvider implements \TYPO3\CMS\Scheduler\AdditionalFieldProviderInter
                }
                $descriptionIndex = $labelNameIndex . '.description';
                $description = $this->getLanguageLabel($descriptionIndex);
-               if (strlen($description) === 0) {
+               if ((string)$description === '') {
                        $description = $argument->getDescription();
                }
-               if (strlen($description) > 0) {
+               if ((string)$description !== '') {
                        $label .= '. <em>' . htmlspecialchars($description) . '</em>';
                }
                return $label;
index 3a9cc21..1553b3e 100644 (file)
@@ -206,10 +206,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') {
@@ -218,7 +218,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 2afed8e..6b3fbd3 100644 (file)
@@ -192,7 +192,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 3d03afb..8891bcd 100644 (file)
@@ -421,7 +421,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 9cc014f..bcd4cef 100644 (file)
@@ -360,7 +360,7 @@ class DateTimeConverterTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         * @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::class);
                        $mockMappingConfiguration
index e04a7f6..f7a3957 100644 (file)
@@ -111,7 +111,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::class);
index fcf53f2..4251744 100644 (file)
@@ -86,10 +86,10 @@ $EM_CONF[$_EXTKEY] = ' . $emConf . ';
                ) {
                        if (!isset($emConf['constraints']) || !isset($emConf['constraints']['depends'])) {
                                $emConf['constraints']['depends'] = $this->stringToDependency($emConf['dependencies']);
-                               if (strlen($emConf['PHP_version'])) {
+                               if ((string)$emConf['PHP_version'] !== '') {
                                        $emConf['constraints']['depends']['php'] = $emConf['PHP_version'];
                                }
-                               if (strlen($emConf['TYPO3_version'])) {
+                               if ((string)$emConf['TYPO3_version'] !== '') {
                                        $emConf['constraints']['depends']['typo3'] = $emConf['TYPO3_version'];
                                }
                        }
@@ -135,7 +135,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 59a873a..8722d46 100644 (file)
@@ -433,7 +433,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 ExtensionManagerException('Could not write file ' . $this->getRelativePath($file), 1344691048);
index 666ca7e..1130e61 100644 (file)
@@ -188,7 +188,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 d0d7171..84e9f28 100644 (file)
@@ -638,17 +638,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'])
                                        );
@@ -661,7 +661,7 @@ class TemplateParser {
                }
 
                // Object Accessor
-               if (strlen($objectAccessorString) > 0) {
+               if ($objectAccessorString !== '') {
 
                        $node = $this->objectManager->get(\TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\ObjectAccessorNode::class, $objectAccessorString);
                        $this->callInterceptor($node, \TYPO3\CMS\Fluid\Core\Parser\InterceptorInterface::INTERCEPT_OBJECTACCESSOR, $state);
index 8f655ca..f7620bb 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 92f98a3..66023a6 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 a0c696d..fc4966c 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 b36b303..824aeec 100644 (file)
@@ -38,7 +38,7 @@ class CaseContentObject extends AbstractContentObject {
                        $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 = (string)$conf[$key] !== '' ? $key : 'default';
                // If no "default" property is available, then an empty string is returned
                if ($key === 'default' && $conf['default'] === NULL) {
                        $theValue = '';
index 5d7609c..e2156f9 100644 (file)
@@ -64,6 +64,7 @@ class ContentContentObject extends AbstractContentObject {
                        $slideCollectFuzzy = TRUE;
                }
                $again = FALSE;
+               $tmpValue = '';
                do {
                        $res = $this->cObj->exec_getQuery($conf['table'], $conf['select.']);
                        if ($error = $GLOBALS['TYPO3_DB']->sql_error()) {
@@ -128,9 +129,9 @@ class ContentContentObject extends AbstractContentObject {
                                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($theValue) && $slideCollectFuzzy || $slide && $slideCollect));
+               } while ($again && $slide && (string)$tmpValue === '' && $slideCollectFuzzy || $slideCollect);
 
                $wrap = isset($conf['wrap.']) ? $this->cObj->stdWrap($conf['wrap'], $conf['wrap.']) : $conf['wrap'];
                if ($wrap) {
index c76d1fe..4993d95 100644 (file)
@@ -2484,7 +2484,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;
@@ -2535,7 +2535,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'])) {
@@ -6133,10 +6133,10 @@ class ContentObjectRenderer {
                                                $linkParameter = $GLOBALS['TSFE']->sys_page->getPageIdFromAlias($linkParameter);
                                        }
                                        // Link to page even if access is missing?
-                                       if (strlen($conf['linkAccessRestrictedPages'])) {
-                                               $disableGroupAccessCheck = $conf['linkAccessRestrictedPages'] ? TRUE : FALSE;
+                                       if (isset($conf['linkAccessRestrictedPages'])) {
+                                               $disableGroupAccessCheck = (bool)$conf['linkAccessRestrictedPages'];
                                        } else {
-                                               $disableGroupAccessCheck = $GLOBALS['TSFE']->config['config']['typolinkLinkAccessRestrictedPages'] ? TRUE : FALSE;
+                                               $disableGroupAccessCheck = (bool)$GLOBALS['TSFE']->config['config']['typolinkLinkAccessRestrictedPages'];
                                        }
                                        // Looking up the page record to verify its existence:
                                        $page = $GLOBALS['TSFE']->sys_page->getPage($linkParameter, $disableGroupAccessCheck);
@@ -6236,7 +6236,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.']);
@@ -6256,7 +6256,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 ef2b1b6..9978c4c 100644 (file)
@@ -370,15 +370,17 @@ class FormContentObject extends AbstractContentObject {
                                                $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;
@@ -419,7 +421,7 @@ class FormContentObject extends AbstractContentObject {
                                }
                                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();
@@ -587,7 +589,7 @@ class FormContentObject extends AbstractContentObject {
                        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 b102e49..81485d3 100644 (file)
@@ -234,15 +234,15 @@ class ImageTextContentObject extends AbstractContentObject {
                                                }
                                        }
                                        // "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 02587a6..d20bcc8 100644 (file)
@@ -1580,7 +1580,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 fea6c55..1d36bb2 100644 (file)
@@ -402,7 +402,7 @@ class GraphicalMenuContentObject extends AbstractMenuContentObject {
                                        $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 feecfdd..1ff28a7 100644 (file)
@@ -84,7 +84,7 @@ class TextMenuContentObject extends AbstractMenuContentObject {
                                $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 43870a4..35f8a78 100644 (file)
@@ -276,7 +276,7 @@ class TranslationStatusController extends \TYPO3\CMS\Backend\Module\AbstractFunc
         * @return array System language records in an array.
         */
        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 bd5cafd..23d3d19 100644 (file)
@@ -1995,7 +1995,7 @@ class TypoScriptFrontendController {
                        }
                } elseif (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'] == '') {
@@ -2773,7 +2773,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;
@@ -2837,7 +2837,7 @@ class TypoScriptFrontendController {
         * @return void
         */
        public function checkJumpUrlReferer() {
-               if (strlen($this->jumpurl) && !$this->TYPO3_CONF_VARS['SYS']['doNotCheckReferer']) {
+               if ($this->jumpurl !== '' && !$this->TYPO3_CONF_VARS['SYS']['doNotCheckReferer']) {
                        $referer = parse_url(GeneralUtility::getIndpEnv('HTTP_REFERER'));
                        if (isset($referer['host']) && !($referer['host'] == GeneralUtility::getIndpEnv('TYPO3_HOST_ONLY'))) {
                                unset($this->jumpurl);
@@ -3239,7 +3239,7 @@ class TypoScriptFrontendController {
                                $lockObj = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Locking\Locker::class, $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();
@@ -4076,7 +4076,7 @@ class TypoScriptFrontendController {
        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;
                        }
                }
@@ -4093,7 +4093,7 @@ class TypoScriptFrontendController {
         * @return void
         */
        public function logDeprecatedTyposcript($typoScriptProperty, $explanation = '') {
-               $explanationText = strlen($explanation) ? ' - ' . $explanation : '';
+               $explanationText = $explanation !== '' ? ' - ' . $explanation : '';
                $GLOBALS['TT']->setTSlogMessage($typoScriptProperty . ' is deprecated.' . $explanationText, 2);
                GeneralUtility::deprecationLog('TypoScript ' . $typoScriptProperty . ' is deprecated' . $explanationText);
        }
@@ -4328,7 +4328,7 @@ class TypoScriptFrontendController {
                        $severity = GeneralUtility::SYSLOG_SEVERITY_WARNING;
                }
 
-               if (strlen($reason)) {
+               if ($reason !== '') {
                        $warning = '$TSFE->set_no_cache() was triggered. Reason: ' . $reason . '.';
                } else {
                        $trace = debug_backtrace();
index 984e498..d342a9c 100644 (file)
@@ -109,7 +109,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 . '|';
                                }
                        }
index 5687ea0..b54e68b 100644 (file)
@@ -517,7 +517,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 fa57774..8b81b7e 100644 (file)
@@ -887,7 +887,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 0cfc846..1977b25 100644 (file)
@@ -238,7 +238,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 0c197da..fd521f0 100644 (file)
@@ -450,9 +450,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 49cb1c8..9891cd3 100644 (file)
@@ -789,7 +789,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) {
@@ -813,12 +813,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);
@@ -1151,7 +1151,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);
                                }
@@ -1291,7 +1291,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 9f501c3..444fd4c 100644 (file)
@@ -113,21 +113,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 3171b3a..dc57df3 100644 (file)
@@ -43,7 +43,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 7f8e859..b83ee60 100644 (file)
@@ -556,7 +556,7 @@ class AbstractController {
                $parameters[] = $controllerParameter;
 
                // Add action if specified
-               if (strlen($action) > 0) {
+               if ((string)$action !== '') {
                        $parameters[] = 'install[action]=' . $action;
                }
 
index c19361b..ae4b3fc 100644 (file)
@@ -370,7 +370,7 @@ class DatabaseConnect extends AbstractStepAction {
                // 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';
@@ -407,15 +407,15 @@ class DatabaseConnect extends AbstractStepAction {
        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);
@@ -627,7 +627,7 @@ class DatabaseConnect extends AbstractStepAction {
        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 77a3e8a..da2d12e 100644 (file)
@@ -32,7 +32,7 @@ class DatabaseData extends AbstractStepAction {
 
                $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 77980d3..28d2e14 100644 (file)
@@ -97,7 +97,7 @@ class DatabaseSelect extends AbstractStepAction {
        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 22a385e..2c15e38 100644 (file)
@@ -124,7 +124,7 @@ class ImportantActions extends Action\AbstractAction {
         */
        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::class);
                        $configurationManager->setLocalConfigurationValueByPath('SYS/sitename', $values['newSiteName']);
index d31a994..d626d28 100644 (file)
@@ -224,7 +224,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 291f73c..4a97d5f 100644 (file)
@@ -212,7 +212,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 c5f075e..0a87c12 100644 (file)
@@ -51,7 +51,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 a771d8d..e11085d 100644 (file)
@@ -354,7 +354,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 407962d..3d0f71c 100644 (file)
@@ -68,7 +68,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]);
@@ -248,7 +248,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 6beeb8a..4cb0187 100644 (file)
@@ -370,25 +370,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');
@@ -425,7 +427,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(
@@ -450,7 +452,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(
index 8ec920a..5b9c489 100644 (file)
@@ -196,7 +196,7 @@ class TerService extends \TYPO3\CMS\Extensionmanager\Utility\Connection\TerUtili
                                                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 22efe4d..31d2e28 100644 (file)
@@ -238,7 +238,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 ec0af89..7fa13b3 100644 (file)
@@ -135,7 +135,7 @@ class ArrayBrowser {
         */
        public function wrapValue($theValue, $depth) {
                $wrappedValue = '';
-               if (strlen($theValue) > 0) {
+               if ((string)$theValue !== '') {
                        $wrappedValue = '<strong>' . htmlspecialchars($theValue) . '</strong>';
                }
                return $wrappedValue;
index 5fdbe81..29c1f14 100644 (file)
@@ -2311,7 +2311,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 bbb3ad4..8abf139 100644 (file)
@@ -329,7 +329,7 @@ class RecordList {
                // It is set, if the clickmenu-layer is active AND the extended view is not enabled.
                $dblist->dontShowClipControlPanels = (!$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 51e9b0c..7d193f3 100644 (file)
@@ -678,7 +678,7 @@ class DatabaseRecordList extends AbstractDatabaseRecordList {
                $iOut = '';
                $id_orig = NULL;
                // 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'];
                }
@@ -776,7 +776,7 @@ class DatabaseRecordList extends AbstractDatabaseRecordList {
                                }
                        }
                        // 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 37ed9e3..8848c8c 100644 (file)
@@ -86,7 +86,7 @@ class RecyclerUtility {
                $output = ($fullOutput = '/');
                while ($uid != 0 && $loopCheck > 0) {
                        $loopCheck--;
-                       $res = $databaseConnection->exec_SELECTquery('uid,pid,title,deleted,t3ver_oid,t3ver_wsid', 'pages', 'uid=' . (int)$uid . (strlen(trim($clause)) ? ' AND ' . $clause : ''));
+                       $res = $databaseConnection->exec_SELECTquery('uid,pid,title,deleted,t3ver_oid,t3ver_wsid', 'pages', 'uid=' . (int)$uid . (trim($clause) !== '' ? ' AND ' . $clause : ''));
                        if (is_resource($res)) {
                                $row = $databaseConnection->sql_fetch_assoc($res);
                                $databaseConnection->sql_free_result($res);
index d1bb0fd..0172f0f 100644 (file)
@@ -474,7 +474,7 @@ var selectedDictionary = "' . $this->dictionary . '";
         * Handler for the opening of a tag
         */
        public function startHandler($xml_parser, $tag, $attributes) {
-               if (strlen($this->xmlCharacterData)) {
+               if ((string)$this->xmlCharacterData !== '') {
                        $this->spellCheckHandler($xml_parser, $this->xmlCharacterData);
                        $this->xmlCharacterData = '';
                }
@@ -515,7 +515,7 @@ var selectedDictionary = "' . $this->dictionary . '";
         * Handler for the closing of a tag
         */
        public function endHandler($xml_parser, $tag) {
-               if (strlen($this->xmlCharacterData)) {
+               if ((string)$this->xmlCharacterData !== '') {
                        $this->spellCheckHandler($xml_parser, $this->xmlCharacterData);
                        $this->xmlCharacterData = '';
                }
index 7d4e1d6..b31ab6e 100644 (file)
@@ -185,7 +185,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 !== '*') {
@@ -211,7 +211,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);
@@ -222,7 +222,7 @@ class NormalizeCommand {
                        }
                        $rangeArray[$fieldNumber] = (int)$fieldValue;
                }
-               $resultList = '';
+
                if (count($rangeArray) === 1) {
                        $resultList = $rangeArray[0];
                } elseif (count($rangeArray) === 2) {
@@ -253,7 +253,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);
@@ -262,10 +262,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 6b3f9d3..ed23427 100644 (file)
@@ -350,7 +350,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;
                        }
                }
@@ -374,7 +374,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']);
                        }
                }
@@ -413,7 +413,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 9a3b3cc..37ae39a 100644 (file)
@@ -218,7 +218,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 aa191a1..6a2e48c 100644 (file)
@@ -630,7 +630,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 940ebc0..a2ddf3c 100644 (file)
@@ -51,7 +51,7 @@ class ReviewController extends AbstractController {
                        $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;