From 6349288cf92b1c0d40ceddff68d0fcf8a17c18dc Mon Sep 17 00:00:00 2001 From: Wouter Wolters <typo3@wouterwolters.nl> Date: Mon, 7 Nov 2016 21:20:57 +0100 Subject: [PATCH] [TASK] Replace beginsWith method with strpos to reduce execution time Use the native PHP method strpos instead of StringUtility::beginsWith method. The beginsWith method runtime compared to a simple strpos check is much higher. Resolves: #78602 Releases: master Change-Id: I608ed791ddd770a8de493e0796387a18b22ff2ce Reviewed-on: https://review.typo3.org/50534 Reviewed-by: Markus Klein <markus.klein@typo3.org> Tested-by: Markus Klein <markus.klein@typo3.org> Tested-by: TYPO3com <no-reply@typo3.com> Reviewed-by: Frank Naegler <frank.naegler@typo3.org> Tested-by: Frank Naegler <frank.naegler@typo3.org> --- .../backend/Classes/Console/CliRequestHandler.php | 3 +-- .../Classes/Controller/Wizard/TableController.php | 5 ++--- .../TcaColumnsProcessPlaceholders.php | 3 +-- .../Form/FormDataProvider/TcaInputPlaceholders.php | 5 ++--- .../backend/Classes/Form/Wizard/SuggestWizard.php | 3 +-- .../sysext/backend/Classes/Utility/BackendUtility.php | 3 +-- .../core/Classes/Database/Schema/SchemaMigrator.php | 11 +++++------ .../Classes/Hooks/BackendUserGroupIntegrityCheck.php | 3 +-- typo3/sysext/core/Classes/Html/RteHtmlParser.php | 3 +-- .../Imaging/IconProvider/BitmapIconProvider.php | 5 ++--- .../Classes/Imaging/IconProvider/SvgIconProvider.php | 5 ++--- typo3/sysext/core/Classes/Migrations/TcaMigration.php | 9 ++++----- .../core/Classes/Resource/ResourceCompressor.php | 3 +-- typo3/sysext/core/Classes/Tests/UnitTestCase.php | 3 +-- .../Classes/TypoScript/Parser/TypoScriptParser.php | 5 ++--- .../core/Classes/TypoScript/TemplateService.php | 7 +++---- .../Classes/Utility/ExtensionManagementUtility.php | 2 +- typo3/sysext/core/Classes/Utility/PathUtility.php | 2 +- .../Classes/Controller/FrontendLoginController.php | 5 ++--- .../Classes/ContentObject/ContentObjectRenderer.php | 10 +++++----- .../Controller/TypoScriptFrontendController.php | 3 +-- .../Domain/Repository/IndexSearchRepository.php | 3 +-- .../Classes/SystemEnvironment/DatabaseCheck.php | 5 ++--- .../install/Classes/Updates/DatabaseCharsetUpdate.php | 5 ++--- .../Classes/UpgradeAnalysis/DocumentationFile.php | 5 ++--- .../linkvalidator/Classes/Linktype/FileLinktype.php | 3 +-- .../linkvalidator/Classes/Linktype/LinkHandler.php | 3 +-- .../Classes/Report/Status/ConfigurationStatus.php | 5 ++--- typo3/sysext/rsaauth/Classes/RsaEncryptionDecoder.php | 4 +--- .../Classes/Hook/Install/DeprecatedRteProperties.php | 3 +-- .../Install/RteAcronymButtonRenamedToAbbreviation.php | 3 +-- .../OptimizeDatabaseTableAdditionalFieldProvider.php | 3 +-- .../Classes/Task/OptimizeDatabaseTableTask.php | 3 +-- 33 files changed, 56 insertions(+), 87 deletions(-) diff --git a/typo3/sysext/backend/Classes/Console/CliRequestHandler.php b/typo3/sysext/backend/Classes/Console/CliRequestHandler.php index 84548b076ff3..ab310f1c7929 100644 --- a/typo3/sysext/backend/Classes/Console/CliRequestHandler.php +++ b/typo3/sysext/backend/Classes/Console/CliRequestHandler.php @@ -19,7 +19,6 @@ use Symfony\Component\Console\Output\ConsoleOutput; use TYPO3\CMS\Core\Console\RequestHandlerInterface; use TYPO3\CMS\Core\Core\Bootstrap; use TYPO3\CMS\Core\Utility\GeneralUtility; -use TYPO3\CMS\Core\Utility\StringUtility; /** * Command Line Interface Request Handler dealing with "cliKey"-based Commands from the cli_dispatch.phpsh script. @@ -169,7 +168,7 @@ class CliRequestHandler implements RequestHandlerInterface if ($GLOBALS['BE_USER']->user['uid']) { throw new \RuntimeException('Another user was already loaded which is impossible in CLI mode!', 1476107444); } - if (!StringUtility::beginsWith($commandLineName, '_CLI_')) { + if (strpos($commandLineName, '_CLI_') !== 0) { throw new \RuntimeException('Module name, "' . $commandLineName . '", was not prefixed with "_CLI_"', 1476107445); } $userName = strtolower($commandLineName); diff --git a/typo3/sysext/backend/Classes/Controller/Wizard/TableController.php b/typo3/sysext/backend/Classes/Controller/Wizard/TableController.php index 630a7d4819c2..86d309226e70 100644 --- a/typo3/sysext/backend/Classes/Controller/Wizard/TableController.php +++ b/typo3/sysext/backend/Classes/Controller/Wizard/TableController.php @@ -25,7 +25,6 @@ use TYPO3\CMS\Core\Imaging\IconFactory; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Core\Utility\HttpUtility; use TYPO3\CMS\Core\Utility\MathUtility; -use TYPO3\CMS\Core\Utility\StringUtility; /** * Script Class for rendering the Table Wizard @@ -503,7 +502,7 @@ class TableController extends AbstractWizardController $cmd = ''; } if ($cmd && MathUtility::canBeInterpretedAsInteger($kk)) { - if (StringUtility::beginsWith($cmd, 'row_')) { + if (strpos($cmd, 'row_') === 0) { switch ($cmd) { case 'row_remove': unset($this->TABLECFG['c'][$kk]); @@ -540,7 +539,7 @@ class TableController extends AbstractWizardController } ksort($this->TABLECFG['c']); } - if (StringUtility::beginsWith($cmd, 'col_')) { + if (strpos($cmd, 'col_') === 0) { foreach ($this->TABLECFG['c'] as $cAK => $value) { switch ($cmd) { case 'col_remove': diff --git a/typo3/sysext/backend/Classes/Form/FormDataProvider/TcaColumnsProcessPlaceholders.php b/typo3/sysext/backend/Classes/Form/FormDataProvider/TcaColumnsProcessPlaceholders.php index b200aaaa5e9b..7f2b1a74c7fb 100644 --- a/typo3/sysext/backend/Classes/Form/FormDataProvider/TcaColumnsProcessPlaceholders.php +++ b/typo3/sysext/backend/Classes/Form/FormDataProvider/TcaColumnsProcessPlaceholders.php @@ -16,7 +16,6 @@ namespace TYPO3\CMS\Backend\Form\FormDataProvider; use TYPO3\CMS\Backend\Form\FormDataProviderInterface; use TYPO3\CMS\Core\Utility\GeneralUtility; -use TYPO3\CMS\Core\Utility\StringUtility; /** * Mark columns that are used by input placeholders for further processing @@ -43,7 +42,7 @@ class TcaColumnsProcessPlaceholders implements FormDataProviderInterface } // Process __row|field type placeholders - if (StringUtility::beginsWith($fieldConfig['config']['placeholder'], '__row|')) { + if (strpos($fieldConfig['config']['placeholder'], '__row|') === 0) { // split field names into array and remove the __row indicator $fieldNameArray = array_slice( GeneralUtility::trimExplode('|', $fieldConfig['config']['placeholder'], true), diff --git a/typo3/sysext/backend/Classes/Form/FormDataProvider/TcaInputPlaceholders.php b/typo3/sysext/backend/Classes/Form/FormDataProvider/TcaInputPlaceholders.php index 2ef165edbbd1..14dac9a714e2 100644 --- a/typo3/sysext/backend/Classes/Form/FormDataProvider/TcaInputPlaceholders.php +++ b/typo3/sysext/backend/Classes/Form/FormDataProvider/TcaInputPlaceholders.php @@ -19,7 +19,6 @@ use TYPO3\CMS\Backend\Form\FormDataGroup\TcaInputPlaceholderRecord; use TYPO3\CMS\Backend\Form\FormDataProviderInterface; use TYPO3\CMS\Backend\Utility\BackendUtility; use TYPO3\CMS\Core\Utility\GeneralUtility; -use TYPO3\CMS\Core\Utility\StringUtility; use TYPO3\CMS\Lang\LanguageService; /** @@ -49,7 +48,7 @@ class TcaInputPlaceholders implements FormDataProviderInterface } // Resolve __row|field type placeholders - if (StringUtility::beginsWith($fieldConfig['config']['placeholder'], '__row|')) { + if (strpos($fieldConfig['config']['placeholder'], '__row|') === 0) { // split field names into array and remove the __row indicator $fieldNameArray = array_slice( GeneralUtility::trimExplode('|', $fieldConfig['config']['placeholder'], true), @@ -59,7 +58,7 @@ class TcaInputPlaceholders implements FormDataProviderInterface } // Resolve placeholders from language files - if (StringUtility::beginsWith($fieldConfig['config']['placeholder'], 'LLL:')) { + if (strpos($fieldConfig['config']['placeholder'], 'LLL:') === 0) { $result['processedTca']['columns'][$fieldName]['config']['placeholder'] = $this->getLanguageService()->sL($fieldConfig['config']['placeholder']); } diff --git a/typo3/sysext/backend/Classes/Form/Wizard/SuggestWizard.php b/typo3/sysext/backend/Classes/Form/Wizard/SuggestWizard.php index d40ef870454c..d8ea1e5a5743 100644 --- a/typo3/sysext/backend/Classes/Form/Wizard/SuggestWizard.php +++ b/typo3/sysext/backend/Classes/Form/Wizard/SuggestWizard.php @@ -22,7 +22,6 @@ use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Core\Utility\ArrayUtility; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Core\Utility\MathUtility; -use TYPO3\CMS\Core\Utility\StringUtility; use TYPO3\CMS\Fluid\View\StandaloneView; use TYPO3\CMS\Lang\LanguageService; @@ -384,7 +383,7 @@ class SuggestWizard protected function isRelevantFlexField($fieldName) { return !( - StringUtility::beginsWith($fieldName, 'ID-') || + strpos($fieldName, 'ID-') === 0 || $fieldName === 'lDEF' || $fieldName === 'vDEF' || $fieldName === 'data' || diff --git a/typo3/sysext/backend/Classes/Utility/BackendUtility.php b/typo3/sysext/backend/Classes/Utility/BackendUtility.php index bd930a6469ad..d1763e5eb4cd 100644 --- a/typo3/sysext/backend/Classes/Utility/BackendUtility.php +++ b/typo3/sysext/backend/Classes/Utility/BackendUtility.php @@ -40,7 +40,6 @@ use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Core\Utility\HttpUtility; use TYPO3\CMS\Core\Utility\MathUtility; use TYPO3\CMS\Core\Utility\PathUtility; -use TYPO3\CMS\Core\Utility\StringUtility; use TYPO3\CMS\Core\Versioning\VersionState; use TYPO3\CMS\Frontend\Page\PageRepository; use TYPO3\CMS\Lang\LanguageService; @@ -1204,7 +1203,7 @@ class BackendUtility $includeTsConfigFileList = GeneralUtility::trimExplode(',', $v['tsconfig_includes'], true); // Traversing list foreach ($includeTsConfigFileList as $key => $includeTsConfigFile) { - if (StringUtility::beginsWith($includeTsConfigFile, 'EXT:')) { + if (strpos($includeTsConfigFile, 'EXT:') === 0) { list($includeTsConfigFileExtensionKey, $includeTsConfigFilename) = explode( '/', substr($includeTsConfigFile, 4), diff --git a/typo3/sysext/core/Classes/Database/Schema/SchemaMigrator.php b/typo3/sysext/core/Classes/Database/Schema/SchemaMigrator.php index 00c6140375a2..2eedd3d75e05 100644 --- a/typo3/sysext/core/Classes/Database/Schema/SchemaMigrator.php +++ b/typo3/sysext/core/Classes/Database/Schema/SchemaMigrator.php @@ -29,7 +29,6 @@ use TYPO3\CMS\Core\Database\Connection; use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Core\Database\Schema\Parser\Parser; use TYPO3\CMS\Core\Utility\GeneralUtility; -use TYPO3\CMS\Core\Utility\StringUtility; /** * Helper methods to handle SQL files and transform them into individual statements @@ -800,7 +799,7 @@ class SchemaMigrator // Skip tables that are not being renamed or where the new name isn't prefixed // with the deletion marker. if ($tableDiff->getNewName() === false - || !StringUtility::beginsWith($tableDiff->getNewName()->getName(), $this->deletedPrefix) + || strpos($tableDiff->getNewName()->getName(), $this->deletedPrefix) !== 0 ) { continue; } @@ -1026,7 +1025,7 @@ class SchemaMigrator Connection $connection ): SchemaDiff { foreach ($schemaDiff->removedTables as $index => $removedTable) { - if (StringUtility::beginsWith($removedTable->getName(), $this->deletedPrefix)) { + if (strpos($removedTable->getName(), $this->deletedPrefix) === 0) { continue; } $tableDiff = GeneralUtility::makeInstance( @@ -1068,7 +1067,7 @@ class SchemaMigrator } foreach ($changedTable->removedColumns as $columnIndex => $removedColumn) { - if (StringUtility::beginsWith($removedColumn->getName(), $this->deletedPrefix)) { + if (strpos($removedColumn->getName(), $this->deletedPrefix) === 0) { continue; } @@ -1166,7 +1165,7 @@ class SchemaMigrator // If the tablename has a deleted prefix strip it of before comparing // it against the list of valid table names so that drop operations // don't get removed. - if (StringUtility::beginsWith($tableName, $this->deletedPrefix)) { + if (strpos($tableName, $this->deletedPrefix) === 0) { $tableName = substr($tableName, strlen($this->deletedPrefix)); } return in_array($tableName, $validTableNames, true) @@ -1249,7 +1248,7 @@ class SchemaMigrator protected function getTableOptions(Connection $connection, array $tableNames): array { $tableOptions = []; - if (!StringUtility::beginsWith($connection->getServerVersion(), 'MySQL')) { + if (strpos($connection->getServerVersion(), 'MySQL') !== 0) { foreach ($tableNames as $tableName) { $tableOptions[$tableName] = []; } diff --git a/typo3/sysext/core/Classes/Hooks/BackendUserGroupIntegrityCheck.php b/typo3/sysext/core/Classes/Hooks/BackendUserGroupIntegrityCheck.php index 8f5487d3728f..fd056c666392 100644 --- a/typo3/sysext/core/Classes/Hooks/BackendUserGroupIntegrityCheck.php +++ b/typo3/sysext/core/Classes/Hooks/BackendUserGroupIntegrityCheck.php @@ -20,7 +20,6 @@ use TYPO3\CMS\Core\Messaging\FlashMessage; use TYPO3\CMS\Core\Messaging\FlashMessageQueue; use TYPO3\CMS\Core\Messaging\FlashMessageService; use TYPO3\CMS\Core\Utility\GeneralUtility; -use TYPO3\CMS\Core\Utility\StringUtility; use TYPO3\CMS\Lang\LanguageService; /** @@ -44,7 +43,7 @@ class BackendUserGroupIntegrityCheck $backendUserGroup = BackendUtility::getRecord($table, $id, 'explicit_allowdeny'); $explicitAllowDenyFields = GeneralUtility::trimExplode(',', $backendUserGroup['explicit_allowdeny']); foreach ($explicitAllowDenyFields as $value) { - if (StringUtility::beginsWith($value, 'tt_content:list_type:')) { + if ($value !== '' && strpos($value, 'tt_content:list_type:') === 0) { if (!in_array('tt_content:CType:list:ALLOW', $explicitAllowDenyFields, true)) { /** @var $flashMessage FlashMessage */ $flashMessage = GeneralUtility::makeInstance( diff --git a/typo3/sysext/core/Classes/Html/RteHtmlParser.php b/typo3/sysext/core/Classes/Html/RteHtmlParser.php index ceb53c677238..9746d0637ad5 100644 --- a/typo3/sysext/core/Classes/Html/RteHtmlParser.php +++ b/typo3/sysext/core/Classes/Html/RteHtmlParser.php @@ -19,7 +19,6 @@ use TYPO3\CMS\Core\Log\LogManager; use TYPO3\CMS\Core\Resource; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Core\Utility\MathUtility; -use TYPO3\CMS\Core\Utility\StringUtility; use TYPO3\CMS\Frontend\Service\TypoLinkCodecService; /** @@ -573,7 +572,7 @@ class RteHtmlParser extends HtmlParser } else { // Check for FAL link-handler keyword: list($linkHandlerKeyword, $linkHandlerValue) = explode(':', trim($link_param), 2); - if ($linkHandlerKeyword === 'file' && !StringUtility::beginsWith($link_param, 'file://')) { + if ($linkHandlerKeyword === 'file' && strpos($link_param, 'file://') !== 0) { $href = $siteUrl . '?' . $linkHandlerKeyword . ':' . rawurlencode($linkHandlerValue); } else { $fileChar = (int)strpos($link_param, '/'); diff --git a/typo3/sysext/core/Classes/Imaging/IconProvider/BitmapIconProvider.php b/typo3/sysext/core/Classes/Imaging/IconProvider/BitmapIconProvider.php index adddca0bff85..bae1fb0e5817 100644 --- a/typo3/sysext/core/Classes/Imaging/IconProvider/BitmapIconProvider.php +++ b/typo3/sysext/core/Classes/Imaging/IconProvider/BitmapIconProvider.php @@ -18,7 +18,6 @@ use TYPO3\CMS\Core\Imaging\Icon; use TYPO3\CMS\Core\Imaging\IconProviderInterface; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Core\Utility\PathUtility; -use TYPO3\CMS\Core\Utility\StringUtility; /** * Class BitmapIconProvider provides icons that are classic <img> tags using bitmaps as source @@ -51,7 +50,7 @@ class BitmapIconProvider implements IconProviderInterface $source = $options['source']; - if (StringUtility::beginsWith($source, 'EXT:') || !StringUtility::beginsWith($source, '/')) { + if (strpos($source, 'EXT:') === 0 || strpos($source, '/') !== 0) { $source = GeneralUtility::getFileAbsFileName($source); } $source = PathUtility::getAbsoluteWebPath($source); @@ -73,7 +72,7 @@ class BitmapIconProvider implements IconProviderInterface $source = $options['source']; - if (StringUtility::beginsWith($source, 'EXT:') || !StringUtility::beginsWith($source, '/')) { + if (strpos($source, 'EXT:') === 0 || strpos($source, '/') !== 0) { $source = GeneralUtility::getFileAbsFileName($source); } diff --git a/typo3/sysext/core/Classes/Imaging/IconProvider/SvgIconProvider.php b/typo3/sysext/core/Classes/Imaging/IconProvider/SvgIconProvider.php index 66ed75ddf69b..df4c203fe67e 100644 --- a/typo3/sysext/core/Classes/Imaging/IconProvider/SvgIconProvider.php +++ b/typo3/sysext/core/Classes/Imaging/IconProvider/SvgIconProvider.php @@ -18,7 +18,6 @@ use TYPO3\CMS\Core\Imaging\Icon; use TYPO3\CMS\Core\Imaging\IconProviderInterface; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Core\Utility\PathUtility; -use TYPO3\CMS\Core\Utility\StringUtility; /** * Class SvgIconProvider provides icons that are classic <img> tags using vectors as source @@ -51,7 +50,7 @@ class SvgIconProvider implements IconProviderInterface $source = $options['source']; - if (StringUtility::beginsWith($source, 'EXT:') || !StringUtility::beginsWith($source, '/')) { + if (strpos($source, 'EXT:') === 0 || strpos($source, '/') !== 0) { $source = GeneralUtility::getFileAbsFileName($source); } @@ -73,7 +72,7 @@ class SvgIconProvider implements IconProviderInterface $source = $options['source']; - if (StringUtility::beginsWith($source, 'EXT:') || !StringUtility::beginsWith($source, '/')) { + if (strpos($source, 'EXT:') === 0 || strpos($source, '/') !== 0) { $source = GeneralUtility::getFileAbsFileName($source); } diff --git a/typo3/sysext/core/Classes/Migrations/TcaMigration.php b/typo3/sysext/core/Classes/Migrations/TcaMigration.php index d3045392a438..fa032094028f 100644 --- a/typo3/sysext/core/Classes/Migrations/TcaMigration.php +++ b/typo3/sysext/core/Classes/Migrations/TcaMigration.php @@ -15,7 +15,6 @@ namespace TYPO3\CMS\Core\Migrations; */ use TYPO3\CMS\Core\Utility\GeneralUtility; -use TYPO3\CMS\Core\Utility\StringUtility; /** * Migrate TCA from old to new syntax. Used in bootstrap and Flex Form Data Structures. @@ -433,12 +432,12 @@ class TcaMigration $path = implode('/', $pathParts); // If the path starts with ext/ or sysext/ migrate it if ( - StringUtility::beginsWith($itemConfig[2], 'ext/') - || StringUtility::beginsWith($itemConfig[2], 'sysext/') + strpos($itemConfig[2], 'ext/') === 0 + || strpos($itemConfig[2], 'sysext/') === 0 ) { $this->messages[] = '[' . $tcaPath . '] ext/ or sysext/ within the path (' . $path . ') in items array is deprecated, use EXT: reference'; $itemConfig[2] = 'EXT:' . $path; - } elseif (StringUtility::beginsWith($itemConfig[2], 'i/')) { + } elseif (strpos($itemConfig[2], 'i/') === 0) { $this->messages[] = '[' . $tcaPath . '] i/ within the path (' . $path . ') in items array is deprecated, use EXT: reference'; $itemConfig[2] = 'EXT:t3skin/icons/gfx/' . $itemConfig[2]; } @@ -490,7 +489,7 @@ class TcaMigration if (!isset($tableDefinition['ctrl']['iconfile'])) { continue; } - if (StringUtility::beginsWith($tableDefinition['ctrl']['iconfile'], '../typo3conf/ext/')) { + if (strpos($tableDefinition['ctrl']['iconfile'], '../typo3conf/ext/') === 0) { $tableDefinition['ctrl']['iconfile'] = str_replace('../typo3conf/ext/', 'EXT:', $tableDefinition['ctrl']['iconfile']); $tcaPath = implode('.', [$table, 'ctrl', 'iconfile']); $this->messages[] = '[' . $tcaPath . '] relative path to ../typo3conf/ext/ is deprecated, use EXT: instead'; diff --git a/typo3/sysext/core/Classes/Resource/ResourceCompressor.php b/typo3/sysext/core/Classes/Resource/ResourceCompressor.php index 08aa05ec3e5e..91359ef0c14e 100644 --- a/typo3/sysext/core/Classes/Resource/ResourceCompressor.php +++ b/typo3/sysext/core/Classes/Resource/ResourceCompressor.php @@ -17,7 +17,6 @@ namespace TYPO3\CMS\Core\Resource; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Core\Utility\MathUtility; use TYPO3\CMS\Core\Utility\PathUtility; -use TYPO3\CMS\Core\Utility\StringUtility; /** * Compressor @@ -284,7 +283,7 @@ class ResourceCompressor $filename = PathUtility::stripPathSitePrefix($filenameAbsolute); $contents = file_get_contents($filenameAbsolute); // remove any UTF-8 byte order mark (BOM) from files - if (StringUtility::beginsWith($contents, "\xEF\xBB\xBF")) { + if (strpos($contents, "\xEF\xBB\xBF") === 0) { $contents = substr($contents, 3); } // only fix paths if files aren't already in typo3temp (already processed) diff --git a/typo3/sysext/core/Classes/Tests/UnitTestCase.php b/typo3/sysext/core/Classes/Tests/UnitTestCase.php index c0bad8482e2b..b6d6937d322a 100644 --- a/typo3/sysext/core/Classes/Tests/UnitTestCase.php +++ b/typo3/sysext/core/Classes/Tests/UnitTestCase.php @@ -16,7 +16,6 @@ namespace TYPO3\CMS\Core\Tests; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Core\Utility\PathUtility; -use TYPO3\CMS\Core\Utility\StringUtility; /** * Base test case for unit tests. @@ -81,7 +80,7 @@ abstract class UnitTestCase extends BaseTestCase if (!GeneralUtility::validPathStr($absoluteFileName)) { throw new \RuntimeException('tearDown() cleanup: Filename contains illegal characters', 1410633087); } - if (!StringUtility::beginsWith($absoluteFileName, PATH_site . 'typo3temp/var/')) { + if (strpos($absoluteFileName, PATH_site . 'typo3temp/var/') !== 0) { throw new \RuntimeException( 'tearDown() cleanup: Files to delete must be within typo3temp/var/', 1410633412 diff --git a/typo3/sysext/core/Classes/TypoScript/Parser/TypoScriptParser.php b/typo3/sysext/core/Classes/TypoScript/Parser/TypoScriptParser.php index f98690d65d7d..33c880686fe3 100644 --- a/typo3/sysext/core/Classes/TypoScript/Parser/TypoScriptParser.php +++ b/typo3/sysext/core/Classes/TypoScript/Parser/TypoScriptParser.php @@ -20,7 +20,6 @@ use TYPO3\CMS\Core\TypoScript\ExtendedTemplateService; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Core\Utility\MathUtility; use TYPO3\CMS\Core\Utility\PathUtility; -use TYPO3\CMS\Core\Utility\StringUtility; /** * The TypoScript parser @@ -495,7 +494,7 @@ class TypoScriptParser $this->lastComment .= rtrim($line) . LF; } } - if (StringUtility::beginsWith($line, '### ERROR')) { + if (strpos($line, '### ERROR') === 0) { $this->error(substr($line, 11)); } } @@ -874,7 +873,7 @@ class TypoScriptParser // load default TypoScript for content rendering templates like // css_styled_content if those have been included through f.e. // <INCLUDE_TYPOSCRIPT: source="FILE:EXT:css_styled_content/static/setup.txt"> - if (StringUtility::beginsWith(strtolower($filename), 'ext:')) { + if (strpos(strtolower($filename), 'ext:') === 0) { $filePointerPathParts = explode('/', substr($filename, 4)); // remove file part, determine whether to load setup or constants diff --git a/typo3/sysext/core/Classes/TypoScript/TemplateService.php b/typo3/sysext/core/Classes/TypoScript/TemplateService.php index 89c4444d0c72..adb5cd5de41e 100644 --- a/typo3/sysext/core/Classes/TypoScript/TemplateService.php +++ b/typo3/sysext/core/Classes/TypoScript/TemplateService.php @@ -28,7 +28,6 @@ use TYPO3\CMS\Core\Utility\ExtensionManagementUtility; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Core\Utility\MathUtility; use TYPO3\CMS\Core\Utility\PathUtility; -use TYPO3\CMS\Core\Utility\StringUtility; use TYPO3\CMS\Frontend\Configuration\TypoScript\ConditionMatching\ConditionMatcher; use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController; use TYPO3\CMS\Frontend\Page\PageRepository; @@ -1212,7 +1211,7 @@ class TemplateService protected function mergeConstantsFromIncludedTsConfigFiles($filesToInclude, $TSdataArray) { foreach ($filesToInclude as $key => $file) { - if (!StringUtility::beginsWith($file, 'EXT:')) { + if (strpos($file, 'EXT:') !== 0) { continue; } @@ -1246,8 +1245,8 @@ class TemplateService { if (is_array($setupArray)) { foreach ($setupArray as $key => $val) { - if ($prefix || !StringUtility::beginsWith($key, 'TSConstantEditor')) { - // We don't want 'TSConstantEditor' in the flattend setup on the first level (190201) + if ($prefix || strpos($key, 'TSConstantEditor') !== 0) { + // We don't want 'TSConstantEditor' in the flattened setup on the first level (190201) if (is_array($val)) { $this->flattenSetup($val, $prefix . $key); } else { diff --git a/typo3/sysext/core/Classes/Utility/ExtensionManagementUtility.php b/typo3/sysext/core/Classes/Utility/ExtensionManagementUtility.php index 427106ad5994..3eb14bb7c387 100644 --- a/typo3/sysext/core/Classes/Utility/ExtensionManagementUtility.php +++ b/typo3/sysext/core/Classes/Utility/ExtensionManagementUtility.php @@ -433,7 +433,7 @@ class ExtensionManagementUtility } if ( isset($fieldArrayWithOptions[$fieldNumber + 1]) - && StringUtility::beginsWith($fieldArrayWithOptions[$fieldNumber + 1], '--palette--') + && strpos($fieldArrayWithOptions[$fieldNumber + 1], '--palette--') === 0 ) { // Match for $field and next field is a palette - add fields to this one $paletteName = GeneralUtility::trimExplode(';', $fieldArrayWithOptions[$fieldNumber + 1]); diff --git a/typo3/sysext/core/Classes/Utility/PathUtility.php b/typo3/sysext/core/Classes/Utility/PathUtility.php index a7e66c907b9d..ec102dd52ce2 100644 --- a/typo3/sysext/core/Classes/Utility/PathUtility.php +++ b/typo3/sysext/core/Classes/Utility/PathUtility.php @@ -40,7 +40,7 @@ class PathUtility public static function getAbsoluteWebPath($targetPath) { if (self::isAbsolutePath($targetPath)) { - if (StringUtility::beginsWith($targetPath, PATH_site)) { + if (strpos($targetPath, PATH_site) === 0) { $targetPath = self::stripPathSitePrefix($targetPath); if (!(TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_CLI)) { $targetPath = GeneralUtility::getIndpEnv('TYPO3_SITE_PATH') . $targetPath; diff --git a/typo3/sysext/felogin/Classes/Controller/FrontendLoginController.php b/typo3/sysext/felogin/Classes/Controller/FrontendLoginController.php index c71a7fc822ea..2e60383d382d 100644 --- a/typo3/sysext/felogin/Classes/Controller/FrontendLoginController.php +++ b/typo3/sysext/felogin/Classes/Controller/FrontendLoginController.php @@ -19,7 +19,6 @@ use TYPO3\CMS\Core\Database\Connection; use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Core\Database\Query\Restriction\FrontendRestrictionContainer; use TYPO3\CMS\Core\Utility\GeneralUtility; -use TYPO3\CMS\Core\Utility\StringUtility; /** * Plugin 'Website User Login' for the 'felogin' extension. @@ -1042,8 +1041,8 @@ class FrontendLoginController extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin { $urlWithoutSchema = preg_replace('#^https?://#', '', $url); $siteUrlWithoutSchema = preg_replace('#^https?://#', '', GeneralUtility::getIndpEnv('TYPO3_SITE_URL')); - return StringUtility::beginsWith($urlWithoutSchema . '/', GeneralUtility::getIndpEnv('HTTP_HOST') . '/') - && StringUtility::beginsWith($urlWithoutSchema, $siteUrlWithoutSchema); + return strpos($urlWithoutSchema . '/', GeneralUtility::getIndpEnv('HTTP_HOST') . '/') === 0 + && strpos($urlWithoutSchema, $siteUrlWithoutSchema) === 0; } /** diff --git a/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php b/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php index 183cef97c968..26ba1fb74305 100644 --- a/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php +++ b/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php @@ -4771,7 +4771,7 @@ class ContentObjectRenderer // tags $len = strcspn(substr($theValue, $pointer), '>') + 1; $data = substr($theValue, $pointer, $len); - if (StringUtility::endsWith($data, '/>') && !StringUtility::beginsWith($data, '<link ')) { + if (StringUtility::endsWith($data, '/>') && strpos($data, '<link ') !== 0) { $tagContent = substr($data, 1, -2); } else { $tagContent = substr($data, 1, -1); @@ -5709,7 +5709,7 @@ class ContentObjectRenderer } // Resolve FAL-api "file:UID-of-sys_file-record" and "file:combined-identifier" - if ($linkHandlerKeyword === 'file' && !StringUtility::beginsWith($linkParameterParts['url'], 'file://')) { + if ($linkHandlerKeyword === 'file' && strpos($linkParameterParts['url'], 'file://') !== 0) { try { $fileOrFolderObject = $this->getResourceFactory()->retrieveFileOrFolderObject($linkHandlerValue); // Link to a folder or file @@ -5849,7 +5849,7 @@ class ContentObjectRenderer $linkLocation = $fileOrFolderObject->getPublicUrl(); // Setting title if blank value to link $linkText = $this->parseFallbackLinkTextIfLinkTextIsEmpty($linkText, rawurldecode($linkLocation)); - $linkLocation = (!StringUtility::beginsWith($linkLocation, '/') ? $tsfe->absRefPrefix : '') . $linkLocation; + $linkLocation = (strpos($linkLocation, '/') !== 0 ? $tsfe->absRefPrefix : '') . $linkLocation; $this->lastTypoLinkUrl = $this->processUrl(UrlProcessorInterface::CONTEXT_FILE, $linkLocation, $conf); $this->lastTypoLinkUrl = $this->forceAbsoluteUrl($this->lastTypoLinkUrl, $conf); @@ -6112,7 +6112,7 @@ class ContentObjectRenderer $linkLocation = $linkDetails['file']; // Setting title if blank value to link $linkText = $this->parseFallbackLinkTextIfLinkTextIsEmpty($linkText, rawurldecode($linkLocation)); - $linkLocation = (!StringUtility::beginsWith($linkLocation, '/') ? $tsfe->absRefPrefix : '') . $linkLocation; + $linkLocation = (strpos($linkLocation, '/') !== 0 ? $tsfe->absRefPrefix : '') . $linkLocation; $this->lastTypoLinkUrl = $this->processUrl(UrlProcessorInterface::CONTEXT_FILE, $linkLocation, $conf); $this->lastTypoLinkUrl = $this->forceAbsoluteUrl($this->lastTypoLinkUrl, $conf); if (empty($target)) { @@ -7782,7 +7782,7 @@ class ContentObjectRenderer } // Static_* tables are allowed to be fetched from root page - if (StringUtility::beginsWith($table, 'static_')) { + if (strpos($table, 'static_') === 0) { $pid_uid_flag++; } diff --git a/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php b/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php index e0fd2bddabb1..ac30f0bb9937 100644 --- a/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php +++ b/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php @@ -44,7 +44,6 @@ use TYPO3\CMS\Core\Utility\ExtensionManagementUtility; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Core\Utility\HttpUtility; use TYPO3\CMS\Core\Utility\MathUtility; -use TYPO3\CMS\Core\Utility\StringUtility; use TYPO3\CMS\Frontend\Authentication\FrontendUserAuthentication; use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer; use TYPO3\CMS\Frontend\Http\UrlHandlerInterface; @@ -4175,7 +4174,7 @@ class TypoScriptFrontendController // This is a hack to work around ___FILE___ resolving symbolic links $PATH_site_real = dirname(realpath(PATH_site . 'typo3')) . '/'; $file = $trace[0]['file']; - if (StringUtility::beginsWith($file, $PATH_site_real)) { + if (strpos($file, $PATH_site_real) === 0) { $file = str_replace($PATH_site_real, '', $file); } else { $file = str_replace(PATH_site, '', $file); diff --git a/typo3/sysext/indexed_search/Classes/Domain/Repository/IndexSearchRepository.php b/typo3/sysext/indexed_search/Classes/Domain/Repository/IndexSearchRepository.php index 8656c6cfd9b1..ea6dc5b8ec68 100644 --- a/typo3/sysext/indexed_search/Classes/Domain/Repository/IndexSearchRepository.php +++ b/typo3/sysext/indexed_search/Classes/Domain/Repository/IndexSearchRepository.php @@ -22,7 +22,6 @@ use TYPO3\CMS\Core\Database\Query\Restriction\FrontendRestrictionContainer; use TYPO3\CMS\Core\TimeTracker\TimeTracker; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Core\Utility\MathUtility; -use TYPO3\CMS\Core\Utility\StringUtility; use TYPO3\CMS\IndexedSearch\Indexer; use TYPO3\CMS\IndexedSearch\Utility; @@ -342,7 +341,7 @@ class IndexSearchRepository protected function getResultRows_SQLpointerMysqlFulltext($searchWordsArray, $freeIndexUid = -1) { $connection = GeneralUtility::makeInstance(ConnectionPool::class)->getConnectionForTable('index_fulltext'); - if (!StringUtility::beginsWith($connection->getServerVersion(), 'MySQL')) { + if (strpos($connection->getServerVersion(), 'MySQL') !== 0) { throw new \RuntimeException( 'Extension indexed_search is configured to use mysql fulltext, but table \'index_fulltext\'' . ' is running on a different DBMS.', diff --git a/typo3/sysext/install/Classes/SystemEnvironment/DatabaseCheck.php b/typo3/sysext/install/Classes/SystemEnvironment/DatabaseCheck.php index 5fab15fe9331..df6122b2e9cf 100644 --- a/typo3/sysext/install/Classes/SystemEnvironment/DatabaseCheck.php +++ b/typo3/sysext/install/Classes/SystemEnvironment/DatabaseCheck.php @@ -18,7 +18,6 @@ use TYPO3\CMS\Core\Database\Connection; use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Core\Database\Query\QueryBuilder; use TYPO3\CMS\Core\Utility\GeneralUtility; -use TYPO3\CMS\Core\Utility\StringUtility; use TYPO3\CMS\Install\Status; /** @@ -51,7 +50,7 @@ class DatabaseCheck $statusArray = []; $defaultConnection = GeneralUtility::makeInstance(ConnectionPool::class) ->getConnectionByName(ConnectionPool::DEFAULT_CONNECTION_NAME); - if (!StringUtility::beginsWith($defaultConnection->getServerVersion(), 'MySQL')) { + if (strpos($defaultConnection->getServerVersion(), 'MySQL') !== 0) { return $statusArray; } $statusArray[] = $this->checkMysqlVersion($defaultConnection); @@ -135,7 +134,7 @@ class DatabaseCheck ->execute() ->fetchColumn(); // also allow utf8mb4 - if (!StringUtility::beginsWith($defaultDatabaseCharset, 'utf8')) { + if (strpos($defaultDatabaseCharset, 'utf8') !== 0) { $status = new Status\ErrorStatus(); $status->setTitle('MySQL database character set check failed'); $status->setMessage( diff --git a/typo3/sysext/install/Classes/Updates/DatabaseCharsetUpdate.php b/typo3/sysext/install/Classes/Updates/DatabaseCharsetUpdate.php index e8f2b1199b31..6f03e8610e31 100644 --- a/typo3/sysext/install/Classes/Updates/DatabaseCharsetUpdate.php +++ b/typo3/sysext/install/Classes/Updates/DatabaseCharsetUpdate.php @@ -17,7 +17,6 @@ namespace TYPO3\CMS\Install\Updates; use Doctrine\DBAL\DBALException; use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Core\Utility\GeneralUtility; -use TYPO3\CMS\Core\Utility\StringUtility; /** * Move "wizard done" flags to system registry @@ -49,7 +48,7 @@ class DatabaseCharsetUpdate extends AbstractUpdate WARNING: This will NOT convert any existing data.'; // check if database charset is utf-8, also allows utf8mb4 - if (!StringUtility::beginsWith($this->getDefaultDatabaseCharset(), 'utf8')) { + if (strpos($this->getDefaultDatabaseCharset(), 'utf8') !== 0) { $result = true; } else { $this->markWizardAsDone(); @@ -97,7 +96,7 @@ class DatabaseCharsetUpdate extends AbstractUpdate $connection = GeneralUtility::makeInstance(ConnectionPool::class) ->getConnectionByName(ConnectionPool::DEFAULT_CONNECTION_NAME); - return StringUtility::beginsWith($connection->getServerVersion(), 'MySQL'); + return strpos($connection->getServerVersion(), 'MySQL') === 0; } /** diff --git a/typo3/sysext/install/Classes/UpgradeAnalysis/DocumentationFile.php b/typo3/sysext/install/Classes/UpgradeAnalysis/DocumentationFile.php index 7cef249d7daf..75cb22ac39a9 100644 --- a/typo3/sysext/install/Classes/UpgradeAnalysis/DocumentationFile.php +++ b/typo3/sysext/install/Classes/UpgradeAnalysis/DocumentationFile.php @@ -16,7 +16,6 @@ namespace TYPO3\CMS\Install\UpgradeAnalysis; */ use TYPO3\CMS\Core\Utility\GeneralUtility; -use TYPO3\CMS\Core\Utility\StringUtility; /** * Provide information about documentation files @@ -87,7 +86,7 @@ class DocumentationFile protected function extractTagsFromFile(array $file): array { foreach ($file as $line) { - if (StringUtility::beginsWith($line, '.. index::')) { + if (strpos($line, '.. index::') === 0) { $tagString = substr($line, strlen('.. index:: ')); return GeneralUtility::trimExplode(',', $tagString, true); } @@ -124,7 +123,7 @@ class DocumentationFile protected function extractHeadline(array $lines): string { $index = 0; - while (StringUtility::beginsWith($lines[$index], '..') || StringUtility::beginsWith($lines[$index], '==')) { + while (strpos($lines[$index], '..') === 0 || strpos($lines[$index], '==') === 0) { $index++; } return trim($lines[$index]); diff --git a/typo3/sysext/linkvalidator/Classes/Linktype/FileLinktype.php b/typo3/sysext/linkvalidator/Classes/Linktype/FileLinktype.php index 6b1599b0fddc..1fe75fe46ca1 100644 --- a/typo3/sysext/linkvalidator/Classes/Linktype/FileLinktype.php +++ b/typo3/sysext/linkvalidator/Classes/Linktype/FileLinktype.php @@ -17,7 +17,6 @@ namespace TYPO3\CMS\Linkvalidator\Linktype; use TYPO3\CMS\Core\Resource\Exception\FileDoesNotExistException; use TYPO3\CMS\Core\Resource\ResourceFactory; use TYPO3\CMS\Core\Utility\GeneralUtility; -use TYPO3\CMS\Core\Utility\StringUtility; /** * This class provides Check File Links plugin implementation @@ -34,7 +33,7 @@ class FileLinktype extends AbstractLinktype */ public function fetchType($value, $type, $key) { - if (StringUtility::beginsWith(strtolower($value['tokenValue']), 'file:')) { + if (strpos(strtolower($value['tokenValue']), 'file:') === 0) { $type = 'file'; } return $type; diff --git a/typo3/sysext/linkvalidator/Classes/Linktype/LinkHandler.php b/typo3/sysext/linkvalidator/Classes/Linktype/LinkHandler.php index 7ae42f1d6bb1..a8f5fc0687e0 100644 --- a/typo3/sysext/linkvalidator/Classes/Linktype/LinkHandler.php +++ b/typo3/sysext/linkvalidator/Classes/Linktype/LinkHandler.php @@ -17,7 +17,6 @@ namespace TYPO3\CMS\Linkvalidator\Linktype; use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction; use TYPO3\CMS\Core\Utility\GeneralUtility; -use TYPO3\CMS\Core\Utility\StringUtility; /** * This class provides Check Link Handler plugin implementation @@ -109,7 +108,7 @@ class LinkHandler extends AbstractLinktype */ public function fetchType($value, $type, $key) { - if ($value['type'] === 'string' && StringUtility::beginsWith(strtolower($value['tokenValue']), 'record:')) { + if ($value['type'] === 'string' && strpos(strtolower($value['tokenValue']), 'record:') === 0) { $type = 'linkhandler'; } return $type; diff --git a/typo3/sysext/reports/Classes/Report/Status/ConfigurationStatus.php b/typo3/sysext/reports/Classes/Report/Status/ConfigurationStatus.php index 1ce737ae53fe..987e7f0d48f3 100644 --- a/typo3/sysext/reports/Classes/Report/Status/ConfigurationStatus.php +++ b/typo3/sysext/reports/Classes/Report/Status/ConfigurationStatus.php @@ -22,7 +22,6 @@ use TYPO3\CMS\Core\Messaging\FlashMessageService; use TYPO3\CMS\Core\Registry; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Core\Utility\PathUtility; -use TYPO3\CMS\Core\Utility\StringUtility; use TYPO3\CMS\Lang\LanguageService; use TYPO3\CMS\Reports\Status as ReportStatus; use TYPO3\CMS\Reports\StatusProviderInterface; @@ -277,7 +276,7 @@ class ConfigurationStatus implements StatusProviderInterface $connection = GeneralUtility::makeInstance(ConnectionPool::class) ->getConnectionByName(ConnectionPool::DEFAULT_CONNECTION_NAME); - return StringUtility::beginsWith($connection->getServerVersion(), 'MySQL'); + return strpos($connection->getServerVersion(), 'MySQL') === 0; } /** @@ -306,7 +305,7 @@ class ConfigurationStatus implements StatusProviderInterface $severity = ReportStatus::OK; $statusValue = $this->getLanguageService()->getLL('status_ok'); // also allow utf8mb4 - if (!StringUtility::beginsWith($defaultDatabaseCharset, 'utf8')) { + if (strpos($defaultDatabaseCharset, 'utf8') !== 0) { // If the default character set is e.g. latin1, BUT all tables in the system are UTF-8, // we assume that TYPO3 has the correct charset for adding tables, and everything is fine $nonUtf8TableCollationsFound = $queryBuilder->select('table_collation') diff --git a/typo3/sysext/rsaauth/Classes/RsaEncryptionDecoder.php b/typo3/sysext/rsaauth/Classes/RsaEncryptionDecoder.php index 98a245b8e11c..04fbb0fc5995 100644 --- a/typo3/sysext/rsaauth/Classes/RsaEncryptionDecoder.php +++ b/typo3/sysext/rsaauth/Classes/RsaEncryptionDecoder.php @@ -14,8 +14,6 @@ namespace TYPO3\CMS\Rsaauth; * The TYPO3 project - inspiring people to share! */ -use TYPO3\CMS\Core\Utility\StringUtility; - /** * This class decodes rsa protected data */ @@ -76,7 +74,7 @@ class RsaEncryptionDecoder implements \TYPO3\CMS\Core\SingletonInterface continue; } - if (!StringUtility::beginsWith($value, 'rsa:')) { + if (strpos($value, 'rsa:') !== 0) { continue; } diff --git a/typo3/sysext/rtehtmlarea/Classes/Hook/Install/DeprecatedRteProperties.php b/typo3/sysext/rtehtmlarea/Classes/Hook/Install/DeprecatedRteProperties.php index a5860800077d..2ede937fea73 100644 --- a/typo3/sysext/rtehtmlarea/Classes/Hook/Install/DeprecatedRteProperties.php +++ b/typo3/sysext/rtehtmlarea/Classes/Hook/Install/DeprecatedRteProperties.php @@ -17,7 +17,6 @@ namespace TYPO3\CMS\Rtehtmlarea\Hook\Install; use Doctrine\DBAL\DBALException; use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Core\Utility\GeneralUtility; -use TYPO3\CMS\Core\Utility\StringUtility; use TYPO3\CMS\Install\Updates\AbstractUpdate; /** @@ -210,7 +209,7 @@ class DeprecatedRteProperties extends AbstractUpdate $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('pages'); $queryBuilder->getRestrictions()->removeAll(); - $isMySQL = StringUtility::beginsWith($queryBuilder->getConnection()->getServerVersion(), 'MySQL'); + $isMySQL = strpos($queryBuilder->getConnection()->getServerVersion(), 'MySQL') === 0; $constraints = []; foreach (array_merge($this->replacementRteProperties, $this->useInsteadRteProperties, $this->doubleReplacementRteProperties) as $deprecatedRteProperty => $_) { diff --git a/typo3/sysext/rtehtmlarea/Classes/Hook/Install/RteAcronymButtonRenamedToAbbreviation.php b/typo3/sysext/rtehtmlarea/Classes/Hook/Install/RteAcronymButtonRenamedToAbbreviation.php index 8e6cb5450f18..ef58bbaaacc7 100644 --- a/typo3/sysext/rtehtmlarea/Classes/Hook/Install/RteAcronymButtonRenamedToAbbreviation.php +++ b/typo3/sysext/rtehtmlarea/Classes/Hook/Install/RteAcronymButtonRenamedToAbbreviation.php @@ -17,7 +17,6 @@ namespace TYPO3\CMS\Rtehtmlarea\Hook\Install; use Doctrine\DBAL\DBALException; use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Core\Utility\GeneralUtility; -use TYPO3\CMS\Core\Utility\StringUtility; use TYPO3\CMS\Install\Updates\AbstractUpdate; /** @@ -115,7 +114,7 @@ class RteAcronymButtonRenamedToAbbreviation extends AbstractUpdate $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('pages'); $queryBuilder->getRestrictions()->removeAll(); - $isMySQL = StringUtility::beginsWith($queryBuilder->getConnection()->getServerVersion(), 'MySQL'); + $isMySQL = strpos($queryBuilder->getConnection()->getServerVersion(), 'MySQL') === 0; if ($isMySQL) { $whereClause = $queryBuilder->expr()->comparison( $queryBuilder->quoteIdentifier('TSconfig'), diff --git a/typo3/sysext/scheduler/Classes/Task/OptimizeDatabaseTableAdditionalFieldProvider.php b/typo3/sysext/scheduler/Classes/Task/OptimizeDatabaseTableAdditionalFieldProvider.php index 6c3483f15586..0257d45ba690 100644 --- a/typo3/sysext/scheduler/Classes/Task/OptimizeDatabaseTableAdditionalFieldProvider.php +++ b/typo3/sysext/scheduler/Classes/Task/OptimizeDatabaseTableAdditionalFieldProvider.php @@ -18,7 +18,6 @@ use TYPO3\CMS\Core\Database\Connection; use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Core\Messaging\FlashMessage; use TYPO3\CMS\Core\Utility\GeneralUtility; -use TYPO3\CMS\Core\Utility\StringUtility; use TYPO3\CMS\Scheduler\AdditionalFieldProviderInterface; use TYPO3\CMS\Scheduler\Controller\SchedulerModuleController; @@ -191,7 +190,7 @@ class OptimizeDatabaseTableAdditionalFieldProvider implements AdditionalFieldPro protected function getOptimizableTablesForConnection(Connection $connection, array $tableNames = []): array { // Return empty list if the database platform is not MySQL - if (!StringUtility::beginsWith($connection->getServerVersion(), 'MySQL')) { + if (strpos($connection->getServerVersion(), 'MySQL') !== 0) { return []; } diff --git a/typo3/sysext/scheduler/Classes/Task/OptimizeDatabaseTableTask.php b/typo3/sysext/scheduler/Classes/Task/OptimizeDatabaseTableTask.php index c7f22d3213da..401ab3a28711 100644 --- a/typo3/sysext/scheduler/Classes/Task/OptimizeDatabaseTableTask.php +++ b/typo3/sysext/scheduler/Classes/Task/OptimizeDatabaseTableTask.php @@ -16,7 +16,6 @@ namespace TYPO3\CMS\Scheduler\Task; use Doctrine\DBAL\DBALException; use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Core\Utility\GeneralUtility; -use TYPO3\CMS\Core\Utility\StringUtility; /** * Perform OPTIMIZE TABLE SQL statements @@ -46,7 +45,7 @@ class OptimizeDatabaseTableTask extends AbstractTask foreach ($this->selectedTables as $tableName) { $connection = $connectionPool->getConnectionForTable($tableName); - if (StringUtility::beginsWith($connection->getServerVersion(), 'MySQL')) { + if (strpos($connection->getServerVersion(), 'MySQL') === 0) { try { $connection->exec('OPTIMIZE TABLE ' . $connection->quoteIdentifier($tableName)); } catch (DBALException $e) { -- GitLab