[CLEANUP] Replace strlen() with === for zero length check 91/27091/10
authorMarkus Klein <klein.t3@mfc-linz.at>
Sun, 23 Feb 2014 10:21:20 +0000 (11:21 +0100)
committerStefan Neufeind <typo3.neufeind@speedpartner.de>
Sun, 23 Feb 2014 10:24:30 +0000 (11:24 +0100)
commitde27a20afbd8f413f60029afc5622c7b33212322
tree0646e813e4b94667de7f312db4256d84bd8ed607
parent0c5a0aa19a3b4b39007d5b7ff3fbfa4620c3adb2
[CLEANUP] Replace strlen() with === for zero length check

It is faster to compare a string with === '' to find out if it's empty
than to run strlen() on it.

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

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