Commit 6349288c authored by Wouter Wolters's avatar Wouter Wolters Committed by Frank Nägler
Browse files

[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's avatarMarkus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein's avatarMarkus Klein <markus.klein@typo3.org>
Tested-by: default avatarTYPO3com <no-reply@typo3.com>
Reviewed-by: Frank Nägler's avatarFrank Naegler <frank.naegler@typo3.org>
Tested-by: Frank Nägler's avatarFrank Naegler <frank.naegler@typo3.org>
parent 44f6cfec
......@@ -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);
......
......@@ -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':
......
......@@ -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),
......
......@@ -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']);
}
......
......@@ -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' ||
......
......@@ -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),
......
......@@ -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] = [];
}
......
......@@ -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(
......
......@@ -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, '/');
......
......@@ -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);
}
......
......@@ -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);
}
......
......@@ -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';
......
......@@ -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)
......
......@@ -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
......
......@@ -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
......
......@@ -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 {
......
......@@ -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]);
......
......@@ -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;
......
......@@ -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;
}
/**
......
......@@ -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++;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment