[TASK] Use $x[n] instead of substr($x, n, 1) 36/27136/8
authorMichiel Roos <michiel@maxserv.nl>
Wed, 29 Jan 2014 20:38:28 +0000 (21:38 +0100)
committerStefan Neufeind <typo3.neufeind@speedpartner.de>
Mon, 3 Feb 2014 22:28:25 +0000 (23:28 +0100)
Change-Id: Ib58894a67f0292b9d62da81511ce12d3f16590ef
Resolves: #55445
Releases: 6.2
Reviewed-on: https://review.typo3.org/27136
Reviewed-by: Markus Klein
Tested-by: Markus Klein
Reviewed-by: Stefan Neufeind
Tested-by: Stefan Neufeind
42 files changed:
typo3/sysext/backend/Classes/ClickMenu/ClickMenu.php
typo3/sysext/backend/Classes/Controller/Wizard/FormsController.php
typo3/sysext/backend/Classes/Controller/Wizard/TableController.php
typo3/sysext/backend/Classes/Form/ElementConditionMatcher.php
typo3/sysext/backend/Classes/Form/FormEngine.php
typo3/sysext/backend/Classes/Form/FrontendFormEngine.php
typo3/sysext/backend/Classes/Template/DocumentTemplate.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/SqlParser.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/Package/Package.php
typo3/sysext/core/Classes/Resource/Filter/FileNameFilter.php
typo3/sysext/core/Classes/TypoScript/ExtendedTemplateService.php
typo3/sysext/core/Classes/TypoScript/Parser/TypoScriptParser.php
typo3/sysext/core/Classes/Utility/DiffUtility.php
typo3/sysext/core/Classes/Utility/GeneralUtility.php
typo3/sysext/core/Classes/Utility/PathUtility.php
typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/Package.php
typo3/sysext/extbase/Classes/DomainObject/AbstractDomainObject.php
typo3/sysext/extbase/Classes/Service/FlexFormService.php
typo3/sysext/felogin/Classes/Controller/FrontendLoginController.php
typo3/sysext/form/Classes/Domain/Factory/TypoScriptFactory.php
typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php
typo3/sysext/frontend/Classes/ContentObject/FormContentObject.php
typo3/sysext/frontend/Classes/ContentObject/MediaContentObject.php
typo3/sysext/frontend/Classes/Page/PageGenerator.php
typo3/sysext/frontend/Classes/Page/PageRepository.php
typo3/sysext/indexed_search/Classes/Utility/DoubleMetaPhoneUtility.php
typo3/sysext/install/Classes/FolderStructure/RootNode.php
typo3/sysext/install/Classes/Service/SqlSchemaMigrationService.php
typo3/sysext/lang/Classes/LanguageService.php
typo3/sysext/lang/Classes/Utility/Connection/Ter.php
typo3/sysext/rtehtmlarea/Classes/Controller/AccessibilityLinkController.php
typo3/sysext/rtehtmlarea/Classes/Controller/SpellCheckingController.php
typo3/sysext/rtehtmlarea/Classes/RteHtmlAreaBase.php
typo3/sysext/saltedpasswords/Classes/SaltedPasswordService.php

index 5ea997a..b397745 100644 (file)
@@ -1324,7 +1324,7 @@ class ClickMenu {
        public function enableDisableItems($menuItems) {
                if ($this->iParts[3]) {
                        // Detect "only" mode: (only showing listed items)
-                       if (substr($this->iParts[3], 0, 1) == '+') {
+                       if ($this->iParts[3][0] === '+') {
                                $this->iParts[3] = substr($this->iParts[3], 1);
                                $only = TRUE;
                        } else {
index 53a7d9f..8ad5b2b 100644 (file)
@@ -781,7 +781,7 @@ class FormsController {
                                // Field:
                                $fParts = GeneralUtility::trimExplode(',', $parts[1]);
                                $fParts[0] = trim($fParts[0]);
-                               if (substr($fParts[0], 0, 1) == '*') {
+                               if ($fParts[0][0] === '*') {
                                        $confData['required'] = 1;
                                        $fParts[0] = substr($fParts[0], 1);
                                }
index ee78db2..1e8be0e 100644 (file)
@@ -590,7 +590,7 @@ class TableController {
                        $vParts = explode($this->tableParsing_delimiter, $v);
                        // Traverse columns:
                        for ($a = 0; $a < $cols; $a++) {
-                               if ($this->tableParsing_quote && substr($vParts[$a], 0, 1) == $this->tableParsing_quote && substr($vParts[$a], -1, 1) == $this->tableParsing_quote) {
+                               if ($this->tableParsing_quote && $vParts[$a][0] === $this->tableParsing_quote && substr($vParts[$a], -1, 1) === $this->tableParsing_quote) {
                                        $vParts[$a] = substr(trim($vParts[$a]), 1, -1);
                                }
                                $cfgArr[$k][$a] = $vParts[$a];
index eb61831..fe5d769 100644 (file)
@@ -227,7 +227,7 @@ class ElementConditionMatcher {
                        case '!-':
                                list($minimum, $maximum) = explode('-', $operand);
                                $result = $fieldValue >= $minimum && $fieldValue <= $maximum;
-                               if ($operator{0} === '!') {
+                               if ($operator[0] === '!') {
                                        $result = !$result;
                                }
                                break;
@@ -236,14 +236,14 @@ class ElementConditionMatcher {
                        case '=':
                        case '!=':
                                $result = \TYPO3\CMS\Core\Utility\GeneralUtility::inList($operand, $fieldValue);
-                               if ($operator{0} === '!') {
+                               if ($operator[0] === '!') {
                                        $result = !$result;
                                }
                                break;
                        case 'BIT':
                        case '!BIT':
                                $result = ((int)$fieldValue & $operand) ? TRUE : FALSE;
-                               if ($operator{0} === '!') {
+                               if ($operator[0] === '!') {
                                        $result = !$result;
                                }
                                break;
index d12c4c0..3f71aa6 100644 (file)
@@ -3430,7 +3430,7 @@ TBE_EDITOR.customEvalFunctions[\'' . $evalData . '\'] = function(value) {
                                        $bit = substr($bitKey, 1);
                                        if (MathUtility::canBeInterpretedAsInteger($bit)) {
                                                $bit = MathUtility::forceIntegerInRange($bit, 0, 30);
-                                               if (substr($bitKey, 0, 1) == '-' && !($sTValue & pow(2, $bit)) || substr($bitKey, 0, 1) == '+' && $sTValue & pow(2, $bit)) {
+                                               if ($bitKey[0] === '-' && !($sTValue & pow(2, $bit)) || $bitKey[0] === '+' && $sTValue & pow(2, $bit)) {
                                                        $excludeElements = array_merge($excludeElements, GeneralUtility::trimExplode(',', $eList, TRUE));
                                                }
                                        }
@@ -4106,7 +4106,7 @@ TBE_EDITOR.customEvalFunctions[\'' . $evalData . '\'] = function(value) {
                if (is_array($wizConf) && !$this->disableWizards) {
                        $parametersOfWizards = &$specConf['wizards']['parameters'];
                        foreach ($wizConf as $wid => $wConf) {
-                               if (substr($wid, 0, 1) != '_' && (!$wConf['enableByTypeConfig'] || is_array($parametersOfWizards) && in_array($wid, $parametersOfWizards)) && ($RTE || !$wConf['RTEonly'])) {
+                               if ($wid[0] !== '_' && (!$wConf['enableByTypeConfig'] || is_array($parametersOfWizards) && in_array($wid, $parametersOfWizards)) && ($RTE || !$wConf['RTEonly'])) {
                                        // Title / icon:
                                        $iTitle = htmlspecialchars($this->sL($wConf['title']));
                                        if ($wConf['icon']) {
index c5a6187..b7c1db8 100644 (file)
@@ -148,7 +148,7 @@ class FrontendFormEngine extends \TYPO3\CMS\Backend\Form\FormEngine {
         * @return string
         */
        private function prependBackPath($url) {
-               if (strpos($url, '://') !== FALSE || substr($url, 0, 1) === '/') {
+               if (strpos($url, '://') !== FALSE || $url[0] === '/') {
                        return $url;
                } else {
                        return $this->backPath . $url;
index 7235e95..2de513e 100644 (file)
@@ -1061,7 +1061,7 @@ class DocumentTemplate {
         */
        public function sectionHeader($label, $sH = FALSE, $addAttrib = '') {
                $tag = $sH ? 'h2' : 'h3';
-               if ($addAttrib && substr($addAttrib, 0, 1) !== ' ') {
+               if ($addAttrib && $addAttrib[0] !== ' ') {
                        $addAttrib = ' ' . $addAttrib;
                }
                $str = '
@@ -1193,7 +1193,7 @@ class DocumentTemplate {
         * @todo Define visibility
         */
        public function addStyleSheet($key, $href, $title = '', $relation = 'stylesheet') {
-               if (strpos($href, '://') !== FALSE || substr($href, 0, 1) === '/') {
+               if (strpos($href, '://') !== FALSE || $href[0] === '/') {
                        $file = $href;
                } else {
                        $file = $this->backPath . $href;
index a52cee4..c638c08 100644 (file)
@@ -1098,7 +1098,7 @@ class CharsetConverter {
         */
        public function utf8CharToUnumber($str, $hex = 0) {
                // First char
-               $ord = ord(substr($str, 0, 1));
+               $ord = ord($str[0]);
                // This verifyes that it IS a multi byte string
                if (($ord & 192) == 192) {
                        $binBuf = '';
@@ -1113,7 +1113,7 @@ class CharsetConverter {
                                        break;
                                }
                        }
-                       $binBuf = substr(('00000000' . decbin(ord(substr($str, 0, 1)))), -(6 - $b)) . $binBuf;
+                       $binBuf = substr(('00000000' . decbin(ord($str[0]))), -(6 - $b)) . $binBuf;
                        $int = bindec($binBuf);
                } else {
                        $int = $ord;
@@ -1158,7 +1158,7 @@ class CharsetConverter {
                                        $detectedType = '';
                                        foreach ($lines as $value) {
                                                // Comment line or blanks are ignored.
-                                               if (trim($value) && substr($value, 0, 1) != '#') {
+                                               if (trim($value) && $value[0] !== '#') {
                                                        // Detect type if not done yet: (Done on first real line)
                                                        // The "whitespaced" type is on the syntax      "0x0A   0x000A  #LINE FEED"     while   "ms-token" is like              "B9 = U+00B9 : SUPERSCRIPT ONE"
                                                        if (!$detectedType) {
index 15583bf..0fb0697 100644 (file)
@@ -178,7 +178,7 @@ abstract class AbstractConditionMatcher {
                $result = FALSE;
                $normalizedExpression = $this->normalizeExpression($expression);
                // First and last character must be square brackets (e.g. "[A]&&[B]":
-               if (substr($normalizedExpression, 0, 1) === '[' && substr($normalizedExpression, -1) === ']') {
+               if ($normalizedExpression[0] === '[' && substr($normalizedExpression, -1) === ']') {
                        $innerExpression = substr($normalizedExpression, 1, -1);
                        $orParts = explode(']||[', $innerExpression);
                        foreach ($orParts as $orPart) {
@@ -241,7 +241,7 @@ abstract class AbstractConditionMatcher {
                                $values = GeneralUtility::trimExplode(',', $value, TRUE);
                                foreach ($values as $test) {
                                        if (strcspn($test, '=<>') == 0) {
-                                               switch (substr($test, 0, 1)) {
+                                               switch ($test[0]) {
                                                        case '=':
                                                                if (doubleval(substr($test, 1)) == $browserInfo['version']) {
                                                                        return TRUE;
@@ -439,14 +439,14 @@ abstract class AbstractConditionMatcher {
                $result = array();
                $arguments = trim($arguments);
                while ($arguments) {
-                       if ($arguments{0} == ',') {
+                       if ($arguments[0] === ',') {
                                $result[] = '';
                                $arguments = substr($arguments, 1);
                        } else {
                                $pos = strcspn($arguments, ',\'"');
                                if ($pos == 0) {
                                        // We hit a quote of some kind
-                                       $quote = $arguments{0};
+                                       $quote = $arguments[0];
                                        $segment = preg_replace('/^(.*?[^\\\])' . $quote . '.*$/', '\1', substr($arguments, 1));
                                        $segment = str_replace('\\' . $quote, $quote, $segment);
                                        $result[] = $segment;
index 5d77959..5eb477f 100644 (file)
@@ -382,7 +382,7 @@ class SystemEnvironmentBuilder {
                                $isRelativePath = TRUE;
                        }
                } else {
-                       if (substr($scriptPath, 0, 1) !== '/') {
+                       if ($scriptPath[0] !== '/') {
                                $isRelativePath = TRUE;
                        }
                }
index f0d8ff8..67c1588 100644 (file)
@@ -971,7 +971,7 @@ class DataHandler {
                                                                $OK = 1;
                                                                // If a NEW... id
                                                                if (strstr($pid_value, 'NEW')) {
-                                                                       if (substr($pid_value, 0, 1) == '-') {
+                                                                       if ($pid_value[0] === '-') {
                                                                                $negFlag = -1;
                                                                                $pid_value = substr($pid_value, 1);
                                                                        } else {
@@ -2486,7 +2486,7 @@ class DataHandler {
                                        break;
                                case 'double2':
                                        $value = preg_replace('/[^0-9,\\.-]/', '', $value);
-                                       $negative = substr($value, 0, 1) == '-';
+                                       $negative = $value[0] === '-';
                                        $value = strtr($value, array(',' => '.', '-' => ''));
                                        if (strpos($value, '.') === FALSE) {
                                                $value .= '.0';
index dd44230..30faae4 100644 (file)
@@ -1243,7 +1243,7 @@ class SqlParser {
                // Field type:
                if ($result['fieldType'] = $this->nextPart($parseString, '^(int|smallint|tinyint|mediumint|bigint|double|numeric|decimal|float|varchar|char|text|tinytext|mediumtext|longtext|blob|tinyblob|mediumblob|longblob)([[:space:],]+|\\()')) {
                        // Looking for value:
-                       if (substr($parseString, 0, 1) == '(') {
+                       if ($parseString[0] === '(') {
                                $parseString = substr($parseString, 1);
                                if ($result['value'] = $this->nextPart($parseString, '^([^)]*)')) {
                                        $parseString = ltrim(substr($parseString, 1));
@@ -1369,7 +1369,7 @@ class SqlParser {
                } else {
                        // Just plain string value, in quotes or not:
                        // Quote?
-                       $firstChar = substr($parseString, 0, 1);
+                       $firstChar = $parseString[0];
                        switch ($firstChar) {
                                case '"':
                                        $value = array($this->getValueInQuotes($parseString, '"'), '"');
index ac32e9f..f56234c 100644 (file)
@@ -599,7 +599,7 @@ class HtmlParser {
                $matches = array();
                if (preg_match_all('/("[^"]*"|\'[^\']*\'|[^\\s"\'\\=]+|\\=)/s', $tag_tmp, $matches) > 0) {
                        foreach ($matches[1] as $part) {
-                               $firstChar = substr($part, 0, 1);
+                               $firstChar = $part[0];
                                if ($firstChar == '"' || $firstChar == '\'') {
                                        $metaValue[] = $firstChar;
                                        $value[] = substr($part, 1, -1);
@@ -748,7 +748,7 @@ class HtmlParser {
                                $tok = substr($tok, $eocPos + 3);
                                $skipTag = TRUE;
                        }
-                       $firstChar = substr($tok, 0, 1);
+                       $firstChar = $tok[0];
                        // It is a tag... (first char is a-z0-9 or /) (fixed 19/01 2004). This also avoids triggering on <?xml..> and <!DOCTYPE..>
                        if (!$skipTag && preg_match('/[[:alnum:]\\/]/', $firstChar) == 1) {
                                $tagEnd = strpos($tok, '>');
@@ -855,7 +855,7 @@ class HtmlParser {
                                                                                                unset($tagAttrib[0][$attr]);
                                                                                        }
                                                                                        if ($params['prefixLocalAnchors']) {
-                                                                                               if (substr($tagAttrib[0][$attr], 0, 1) == '#') {
+                                                                                               if ($tagAttrib[0][$attr][0] === '#') {
                                                                                                        $prefix = GeneralUtility::getIndpEnv('TYPO3_REQUEST_URL');
                                                                                                        $tagAttrib[0][$attr] = $prefix . $tagAttrib[0][$attr];
                                                                                                        if ($params['prefixLocalAnchors'] == 2 && GeneralUtility::isFirstPartOfStr($prefix, GeneralUtility::getIndpEnv('TYPO3_SITE_URL'))) {
@@ -865,7 +865,7 @@ class HtmlParser {
                                                                                        }
                                                                                        if ($params['prefixRelPathWith']) {
                                                                                                $urlParts = parse_url($tagAttrib[0][$attr]);
-                                                                                               if (!$urlParts['scheme'] && substr($urlParts['path'], 0, 1) != '/') {
+                                                                                               if (!$urlParts['scheme'] && $urlParts['path'][0] !== '/') {
                                                                                                        // If it is NOT an absolute URL (by http: or starting "/")
                                                                                                        $tagAttrib[0][$attr] = $params['prefixRelPathWith'] . $tagAttrib[0][$attr];
                                                                                                }
@@ -1103,7 +1103,7 @@ class HtmlParser {
        public function prefixRelPath($prefix, $srcVal, $suffix = '') {
                // Only prefix if it's not an absolute URL or
                // only a link to a section within the page.
-               if (substr($srcVal, 0, 1) != '/' && substr($srcVal, 0, 1) != '#') {
+               if ($srcVal[0] !== '/' && $srcVal[0] !== '#') {
                        $urlParts = parse_url($srcVal);
                        // Only prefix URLs without a scheme
                        if (!$urlParts['scheme']) {
@@ -1183,7 +1183,7 @@ class HtmlParser {
                next($contentParts);
                // bypass the first
                while (list($k, $tok) = each($contentParts)) {
-                       $firstChar = substr($tok, 0, 1);
+                       $firstChar = $tok[0];
                        if (trim($firstChar) !== '') {
                                $subparts = explode('&gt;', $tok, 2);
                                $tagEnd = strlen($subparts[0]);
index 3791e5f..54ec972 100644 (file)
@@ -752,7 +752,7 @@ class RteHtmlParser extends \TYPO3\CMS\Core\Html\HtmlParser {
                                if (strstr($link_param, '@') && (!$pU['scheme'] || $pU['scheme'] == 'mailto')) {
                                        // mailadr
                                        $href = 'mailto:' . preg_replace('/^mailto:/i', '', $link_param);
-                               } elseif (substr($link_param, 0, 1) == '#') {
+                               } elseif ($link_param[0] === '#') {
                                        // check if anchor
                                        $href = $siteUrl . $link_param;
                                } else {
index 71d0eb8..1498816 100644 (file)
@@ -2069,7 +2069,7 @@ class GraphicalFunctions {
                // ... and possibly recalculating the value
                if (trim($cParts[1])) {
                        $cParts[1] = trim($cParts[1]);
-                       if (substr($cParts[1], 0, 1) == '*') {
+                       if ($cParts[1][0] === '*') {
                                $val = doubleval(substr($cParts[1], 1));
                                $col[0] = MathUtility::forceIntegerInRange($col[0] * $val, 0, 255);
                                $col[1] = MathUtility::forceIntegerInRange($col[1] * $val, 0, 255);
index 6bacc35..bdff2ce 100644 (file)
@@ -257,7 +257,7 @@ class Rfc822AddressesParser {
                // If the next char is a comma and this was a group, then
                // there are more addresses, otherwise, if there are any more
                // chars, then there is another address.
-               if ($is_group && substr($address, 0, 1) == ',') {
+               if ($is_group && $address[0] === ',') {
                        $address = trim(substr($address, 1));
                        return $address;
                } elseif (strlen($address) > 0) {
@@ -473,7 +473,7 @@ class Rfc822AddressesParser {
                }
                foreach ($phrase_parts as $part) {
                        // If quoted string:
-                       if (substr($part, 0, 1) == '"') {
+                       if ($part[0] === '"') {
                                if (!$this->_validateQuotedString($part)) {
                                        return FALSE;
                                }
@@ -571,7 +571,7 @@ class Rfc822AddressesParser {
                }
                $mailbox = trim($mailbox);
                // Check for name + route-addr
-               if (substr($mailbox, -1) == '>' && substr($mailbox, 0, 1) != '<') {
+               if (substr($mailbox, -1) === '>' && $mailbox[0] !== '<') {
                        $parts = explode('<', $mailbox);
                        $name = $this->_splitCheck($parts, '<');
                        $phrase = trim($name);
@@ -581,7 +581,7 @@ class Rfc822AddressesParser {
                        }
                } else {
                        // First snip angle brackets if present.
-                       if (substr($mailbox, 0, 1) == '<' && substr($mailbox, -1) == '>') {
+                       if ($mailbox[0] === '<' && substr($mailbox, -1) === '>') {
                                $addr_spec = substr($mailbox, 1, -1);
                        } else {
                                $addr_spec = $mailbox;
index b28a9f4..a8f770c 100644 (file)
@@ -79,7 +79,7 @@ class Package extends \TYPO3\Flow\Package\Package implements PackageInterface {
                if (substr($packagePath, -1, 1) !== '/') {
                        throw new \TYPO3\Flow\Package\Exception\InvalidPackagePathException(sprintf('The package path "%s" provided for package "%s" has no trailing forward slash.', $packagePath, $packageKey), 1166633720);
                }
-               if (substr($classesPath, 1, 1) === '/') {
+               if ($classesPath[1] === '/') {
                        throw new \TYPO3\Flow\Package\Exception\InvalidPackagePathException(sprintf('The package classes path provided for package "%s" has a leading forward slash.', $packageKey), 1334841320);
                }
                if (!@file_exists($packagePath . $manifestPath . 'ext_emconf.php')) {
index 19a3bfd..63e1261 100644 (file)
@@ -55,7 +55,7 @@ class FileNameFilter {
         */
        static public function filterHiddenFilesAndFolders($itemName, $itemIdentifier, $parentIdentifier, array $additionalInformation, \TYPO3\CMS\Core\Resource\Driver\DriverInterface $driverInstance) {
                // Only apply the filter if you want to hide the hidden files
-               if (self::$showHiddenFilesAndFolders === FALSE && substr($itemName, 0, 1) == '.') {
+               if (self::$showHiddenFilesAndFolders === FALSE && $itemName[0] === '.') {
                        return -1;
                } else {
                        return TRUE;
index 755f035..eec4270 100644 (file)
@@ -415,7 +415,7 @@ class ExtendedTemplateService extends \TYPO3\CMS\Core\TypoScript\TemplateService
                        $a++;
                        $depth = $depth_in . $key;
                        // This excludes all constants starting with '_' from being shown.
-                       if ($this->bType != 'const' || substr($depth, 0, 1) != '_') {
+                       if ($this->bType !== 'const' || $depth[0] !== '_') {
                                $goto = substr(md5($depth), 0, 6);
                                $deeper = is_array($arr[$key . '.']) && ($this->tsbrowser_depthKeys[$depth] || $this->ext_expandAllNotes) ? 1 : 0;
                                $PM = 'join';
@@ -1013,7 +1013,7 @@ class ExtendedTemplateService extends \TYPO3\CMS\Core\TypoScript\TemplateService
                                        $retArr['paramstr'] = $p;
                                        switch ($retArr['type']) {
                                                case 'int':
-                                                       if (substr($retArr['paramstr'], 0, 1) == '-') {
+                                                       if ($retArr['paramstr'][0] === '-') {
                                                                $retArr['params'] = GeneralUtility::intExplode('-', substr($retArr['paramstr'], 1));
                                                                $retArr['params'][0] = (int)('-' . $retArr['params'][0]);
                                                        } else {
@@ -1369,13 +1369,13 @@ class ExtendedTemplateService extends \TYPO3\CMS\Core\TypoScript\TemplateService
                        }
                        $this->rawP++;
                        if ($line) {
-                               if (substr($line, 0, 1) == '[') {
+                               if ($line[0] === '[') {
 
                                } elseif (strcspn($line, '}#/') != 0) {
                                        $varL = strcspn($line, ' {=<');
                                        $var = substr($line, 0, $varL);
                                        $line = ltrim(substr($line, $varL));
-                                       switch (substr($line, 0, 1)) {
+                                       switch ($line[0]) {
                                                case '=':
                                                        $this->objReg[$pre . $var] = $this->rawP - 1;
                                                        break;
@@ -1385,7 +1385,7 @@ class ExtendedTemplateService extends \TYPO3\CMS\Core\TypoScript\TemplateService
                                                        break;
                                        }
                                        $this->lastComment = '';
-                               } elseif (substr($line, 0, 1) == '}') {
+                               } elseif ($line[0] === '}') {
                                        $this->lastComment = '';
                                        $this->ext_inBrace--;
                                        if ($this->ext_inBrace < 0) {
@@ -1513,13 +1513,13 @@ class ExtendedTemplateService extends \TYPO3\CMS\Core\TypoScript\TemplateService
                                                                if ($var && !GeneralUtility::inList($this->HTMLcolorList, strtolower($var))) {
                                                                        $var = preg_replace('/[^A-Fa-f0-9]*/', '', $var);
                                                                        $useFulHex = strlen($var) > 3;
-                                                                       $col[] = HexDec(substr($var, 0, 1));
-                                                                       $col[] = HexDec(substr($var, 1, 1));
-                                                                       $col[] = HexDec(substr($var, 2, 1));
+                                                                       $col[] = HexDec($var[0]);
+                                                                       $col[] = HexDec($var[1]);
+                                                                       $col[] = HexDec($var[2]);
                                                                        if ($useFulHex) {
-                                                                               $col[] = HexDec(substr($var, 3, 1));
-                                                                               $col[] = HexDec(substr($var, 4, 1));
-                                                                               $col[] = HexDec(substr($var, 5, 1));
+                                                                               $col[] = HexDec($var[3]);
+                                                                               $col[] = HexDec($var[4]);
+                                                                               $col[] = HexDec($var[5]);
                                                                        }
                                                                        $var = substr(('0' . DecHex($col[0])), -1) . substr(('0' . DecHex($col[1])), -1) . substr(('0' . DecHex($col[2])), -1);
                                                                        if ($useFulHex) {
index c375443..2450182 100644 (file)
@@ -231,7 +231,7 @@ class TypoScriptParser {
                                break;
                        }
                        $preUppercase = strtoupper($pre);
-                       if ($pre{0} === '[' &&
+                       if ($pre[0] === '[' &&
                                ($preUppercase === '[GLOBAL]' ||
                                        $preUppercase === '[END]' ||
                                        !$this->lastConditionTrue && $preUppercase === '[ELSE]')
@@ -276,7 +276,7 @@ class TypoScriptParser {
                while (isset($this->raw[$this->rawP])) {
                        $line = trim($this->raw[$this->rawP]);
                        $this->rawP++;
-                       if ($line && $line{0} === '[') {
+                       if ($line && $line[0] === '[') {
                                return $line;
                        }
                }
@@ -311,7 +311,7 @@ class TypoScriptParser {
                                // If multiline is enabled. Escape by ')'
                                if ($this->multiLineEnabled) {
                                        // Multiline ends...
-                                       if ($line{0} === ')') {
+                                       if ($line[0] === ')') {
                                                if ($this->syntaxHighLight) {
                                                        $this->regHighLight('operator', $lineP, strlen($line) - 1);
                                                }
@@ -337,7 +337,7 @@ class TypoScriptParser {
                                                }
                                                $this->multiLineValue[] = $this->raw[$this->rawP - 1];
                                        }
-                               } elseif ($this->inBrace === 0 && $line{0} === '[') {
+                               } elseif ($this->inBrace === 0 && $line[0] === '[') {
                                        // Beginning of condition (only on level zero compared to brace-levels
                                        if ($this->syntaxHighLight) {
                                                $this->regHighLight('condition', $lineP);
@@ -345,14 +345,14 @@ class TypoScriptParser {
                                        return $line;
                                } else {
                                        // Return if GLOBAL condition is set - no matter what.
-                                       if ($line{0} === '[' && stripos($line, '[GLOBAL]') !== FALSE) {
+                                       if ($line[0] === '[' && stripos($line, '[GLOBAL]') !== FALSE) {
                                                if ($this->syntaxHighLight) {
                                                        $this->regHighLight('condition', $lineP);
                                                }
                                                $this->error('Line ' . ($this->lineNumberOffset + $this->rawP - 1) . ': On return to [GLOBAL] scope, the script was short of ' . $this->inBrace . ' end brace(s)', 1);
                                                $this->inBrace = 0;
                                                return $line;
-                                       } elseif ($line{0} !== '}' && $line{0} !== '#' && $line{0} !== '/') {
+                                       } elseif ($line[0] !== '}' && $line[0] !== '#' && $line[0] !== '/') {
                                                // If not brace-end or comment
                                                // Find object name string until we meet an operator
                                                $varL = strcspn($line, TAB . ' {=<>:(');
@@ -379,7 +379,7 @@ class TypoScriptParser {
                                                                } else {
                                                                        // Checking for special TSparser properties (to change TS values at parsetime)
                                                                        $match = array();
-                                                                       if ($line{0} === ':' && preg_match('/^:=\\s*([^\\(]+)\\s*\\((.*)\\).*/', $line, $match)) {
+                                                                       if ($line[0] === ':' && preg_match('/^:=\\s*([^\\(]+)\\s*\\((.*)\\).*/', $line, $match)) {
                                                                                $tsFunc = $match[1];
                                                                                $tsFuncArg = $match[2];
                                                                                list($currentValue) = $this->getVal($objStrName, $setup);
@@ -389,7 +389,7 @@ class TypoScriptParser {
                                                                                        $line = '= ' . $newValue;
                                                                                }
                                                                        }
-                                                                       switch ($line{0}) {
+                                                                       switch ($line[0]) {
                                                                                case '=':
                                                                                        if ($this->syntaxHighLight) {
                                                                                                $this->regHighLight('value', $lineP, strlen(ltrim(substr($line, 1))) - strlen(trim(substr($line, 1))));
@@ -436,7 +436,7 @@ class TypoScriptParser {
                                                                                                $this->regHighLight('value_copy', $lineP, strlen(ltrim(substr($line, 1))) - strlen(trim(substr($line, 1))));
                                                                                        }
                                                                                        $theVal = trim(substr($line, 1));
-                                                                                       if ($theVal{0} === '.') {
+                                                                                       if ($theVal[0] === '.') {
                                                                                                $res = $this->getVal(substr($theVal, 1), $setup);
                                                                                        } else {
                                                                                                $res = $this->getVal($theVal, $this->setup);
@@ -457,7 +457,7 @@ class TypoScriptParser {
                                                        }
                                                        $this->lastComment = '';
                                                }
-                                       } elseif ($line{0} === '}') {
+                                       } elseif ($line[0] === '}') {
                                                $this->inBrace--;
                                                $this->lastComment = '';
                                                if ($this->syntaxHighLight) {
@@ -751,7 +751,7 @@ class TypoScriptParser {
                                $tsContentsTillNextInclude = $parts[$i + 3];
 
                                // Resolve a possible relative paths if a parent file is given
-                               if ($parentFilenameOrPath !== '' && GeneralUtility::isFirstPartOfStr($filename, '.')) {
+                               if ($parentFilenameOrPath !== '' && $filename[0] === '.') {
                                        $filename = PathUtility::getAbsolutePathOfRelativeReferencedFileOrPath($parentFilenameOrPath, $filename);
                                }
 
@@ -828,7 +828,7 @@ class TypoScriptParser {
         */
        public static function includeFile($filename, $cycle_counter = 1, $returnFiles = FALSE, &$newString = '', array &$includedFiles = array(), $optionalProperties = '', $parentFilenameOrPath = '') {
                // Resolve a possible relative paths if a parent file is given
-               if ($parentFilenameOrPath !== '' && GeneralUtility::isFirstPartOfStr($filename, '.')) {
+               if ($parentFilenameOrPath !== '' && $filename[0] === '.') {
                        $absfilename = PathUtility::getAbsolutePathOfRelativeReferencedFileOrPath($parentFilenameOrPath, $filename);
                } else {
                        $absfilename = $filename;
@@ -884,7 +884,7 @@ class TypoScriptParser {
                }
 
                // Resolve a possible relative paths if a parent file is given
-               if ($parentFilenameOrPath !== '' && GeneralUtility::isFirstPartOfStr($dirPath, '.')) {
+               if ($parentFilenameOrPath !== '' && $dirPath[0] === '.') {
                        $absDirPath = PathUtility::getAbsolutePathOfRelativeReferencedFileOrPath($parentFilenameOrPath, $dirPath);
                } else {
                        $absDirPath = $dirPath;
@@ -1004,7 +1004,7 @@ class TypoScriptParser {
                                        // Write the content to the file
 
                                        // Resolve a possible relative paths if a parent file is given
-                                       if ($parentFilenameOrPath !== '' && GeneralUtility::isFirstPartOfStr($fileName, '.')) {
+                                       if ($parentFilenameOrPath !== '' && $fileName[0] === '.') {
                                                $realFileName = PathUtility::getAbsolutePathOfRelativeReferencedFileOrPath($parentFilenameOrPath, $fileName);
                                        } else {
                                                $realFileName = $fileName;
index 0075c4c..1addb8a 100644 (file)
@@ -88,10 +88,10 @@ class DiffUtility {
                                        $c = (int)$lValue;
                                        $diffResArray[$c]['changeInfo'] = $lValue;
                                }
-                               if (substr($lValue, 0, 1) == '<') {
+                               if ($lValue[0] === '<') {
                                        $differenceStr .= ($diffResArray[$c]['old'][] = substr($lValue, 2));
                                }
-                               if (substr($lValue, 0, 1) == '>') {
+                               if ($lValue[0] === '>') {
                                        $differenceStr .= ($diffResArray[$c]['new'][] = substr($lValue, 2));
                                }
                        }
index 6846799..61d67ec 100644 (file)
@@ -1355,7 +1355,7 @@ class GeneralUtility {
         * @return string The string with the first character as lowercase
         */
        static public function lcfirst($string) {
-               return self::strtolower(substr($string, 0, 1)) . substr($string, 1);
+               return self::strtolower($string[0]) . substr($string, 1);
        }
 
        /**
@@ -1897,7 +1897,7 @@ class GeneralUtility {
                $value = array();
                // Compared with empty string instead , 030102
                while ($tag_tmp !== '') {
-                       $firstChar = substr($tag_tmp, 0, 1);
+                       $firstChar = $tag_tmp[0];
                        if ($firstChar === '"' || $firstChar === '\'') {
                                $reg = explode($firstChar, $tag_tmp, 3);
                                $value[] = $reg[1];
@@ -2256,7 +2256,7 @@ class GeneralUtility {
                        // Test for numeric tag, encoded on the form "nXXX":
                        $testNtag = substr($tagName, 1);
                        // Closing tag.
-                       $tagName = substr($tagName, 0, 1) == 'n' && MathUtility::canBeInterpretedAsInteger($testNtag) ? (int)$testNtag : $tagName;
+                       $tagName = $tagName[0] === 'n' && MathUtility::canBeInterpretedAsInteger($testNtag) ? (int)$testNtag : $tagName;
                        // Test for alternative index value:
                        if (strlen($val['attributes']['index'])) {
                                $tagName = $val['attributes']['index'];
@@ -3024,7 +3024,7 @@ Connection: close
        static public function locationHeaderUrl($path) {
                $uI = parse_url($path);
                // relative to HOST
-               if (substr($path, 0, 1) == '/') {
+               if ($path[0] === '/') {
                        $path = self::getIndpEnv('TYPO3_REQUEST_HOST') . $path;
                } elseif (!$uI['scheme']) {
                        // No scheme either
@@ -3669,7 +3669,7 @@ Connection: close
                        return TRUE;
                }
                // Path starting with a / is always absolute, on every system
-               return substr($path, 0, 1) === '/';
+               return $path[0] === '/';
        }
 
        /**
@@ -3753,9 +3753,9 @@ Connection: close
                                }
                        } elseif (self::isAbsPath($decodedUrl) && self::isAllowedAbsPath($decodedUrl)) {
                                $sanitizedUrl = $url;
-                       } elseif (strpos($testAbsoluteUrl, self::getIndpEnv('TYPO3_SITE_PATH')) === 0 && substr($decodedUrl, 0, 1) === '/') {
+                       } elseif (strpos($testAbsoluteUrl, self::getIndpEnv('TYPO3_SITE_PATH')) === 0 && $decodedUrl[0] === '/') {
                                $sanitizedUrl = $url;
-                       } elseif (strpos($testRelativeUrl, self::getIndpEnv('TYPO3_SITE_PATH')) === 0 && substr($decodedUrl, 0, 1) !== '/') {
+                       } elseif (strpos($testRelativeUrl, self::getIndpEnv('TYPO3_SITE_PATH')) === 0 && $decodedUrl[0] !== '/') {
                                $sanitizedUrl = $url;
                        }
                }
@@ -4092,7 +4092,7 @@ Connection: close
                        $funcRef = $funcName;
                }
                // Check for persistent object token, "&"
-               if (substr($funcRef, 0, 1) == '&') {
+               if ($funcRef[0] === '&') {
                        $funcRef = substr($funcRef, 1);
                        $storePersistentObject = TRUE;
                } else {
@@ -4186,7 +4186,7 @@ Connection: close
                                $class = $classRef;
                        }
                        // Check for persistent object token, "&"
-                       if (substr($class, 0, 1) == '&') {
+                       if ($class[0] === '&') {
                                $class = substr($class, 1);
                                $storePersistentObject = TRUE;
                        } else {
index 074acae..c5f0892 100644 (file)
@@ -205,7 +205,7 @@ class PathUtility {
                        return TRUE;
                }
                // Path starting with a / is always absolute, on every system
-               return substr($path, 0, 1) === '/';
+               return $path[0] === '/';
        }
 
        /**
index f70cd68..add38aa 100644 (file)
@@ -108,7 +108,7 @@ class Package implements PackageInterface {
                if (substr($packagePath, -1, 1) !== '/') {
                        throw new \TYPO3\Flow\Package\Exception\InvalidPackagePathException(sprintf('The package path "%s" provided for package "%s" has no trailing forward slash.', $packagePath, $packageKey), 1166633720);
                }
-               if (substr($classesPath, 1, 1) === '/') {
+               if ($classesPath[1] === '/') {
                        throw new \TYPO3\Flow\Package\Exception\InvalidPackagePathException(sprintf('The package classes path provided for package "%s" has a leading forward slash.', $packageKey), 1334841320);
                }
                if (!file_exists($packagePath . $manifestPath . 'composer.json')) {
index f05fac1..f32d5c8 100644 (file)
@@ -153,7 +153,7 @@ abstract class AbstractDomainObject implements \TYPO3\CMS\Extbase\DomainObject\D
        public function _getProperties() {
                $properties = get_object_vars($this);
                foreach ($properties as $propertyName => $propertyValue) {
-                       if (substr($propertyName, 0, 1) === '_') {
+                       if ($propertyName[0] === '_') {
                                unset($properties[$propertyName]);
                        }
                }
@@ -193,7 +193,7 @@ abstract class AbstractDomainObject implements \TYPO3\CMS\Extbase\DomainObject\D
                        $this->_cleanProperties = array();
                        $properties = get_object_vars($this);
                        foreach ($properties as $propertyName => $propertyValue) {
-                               if (substr($propertyName, 0, 1) === '_') {
+                               if ($propertyName[0] === '_') {
                                        continue;
                                }
                                // Do not memorize "internal" properties
index 7aedf84..3d160b0 100644 (file)
@@ -93,7 +93,7 @@ class FlexFormService implements \TYPO3\CMS\Core\SingletonInterface {
                                if (in_array($nodeKey, array('el', '_arrayContainer'))) {
                                        return $this->walkFlexFormNode($nodeValue, $valuePointer);
                                }
-                               if (substr($nodeKey, 0, 1) === '_') {
+                               if ($nodeKey[0] === '_') {
                                        continue;
                                }
                                if (strpos($nodeKey, '.')) {
index ff61127..17ef889 100644 (file)
@@ -1014,7 +1014,7 @@ class FrontendLoginController extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin
                $parsedUrl = @parse_url($url);
                if ($parsedUrl !== FALSE && !isset($parsedUrl['scheme']) && !isset($parsedUrl['host'])) {
                        // If the relative URL starts with a slash, we need to check if it's within the current site path
-                       return !GeneralUtility::isFirstPartOfStr($parsedUrl['path'], '/') || GeneralUtility::isFirstPartOfStr($parsedUrl['path'], GeneralUtility::getIndpEnv('TYPO3_SITE_PATH'));
+                       return $parsedUrl['path'][0] !== '/' || GeneralUtility::isFirstPartOfStr($parsedUrl['path'], GeneralUtility::getIndpEnv('TYPO3_SITE_PATH'));
                }
                return FALSE;
        }
index 79de33e..61d7b78 100644 (file)
@@ -116,7 +116,7 @@ class TypoScriptFactory implements \TYPO3\CMS\Core\SingletonInterface {
                if (in_array($class, \TYPO3\CMS\Form\Utility\FormUtility::getInstance()->getFormObjects())) {
                        $this->addElement($parentElement, $class, $arguments);
                } elseif ($this->disableContentElement === FALSE) {
-                       if (substr($class, 0, 1) == '<') {
+                       if ($class[0] === '<') {
                                $key = trim(substr($class, 1));
                                /** @var $typoscriptParser \TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser */
                                $typoscriptParser = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\TypoScript\\Parser\\TypoScriptParser');
index 86d0150..9992ebf 100644 (file)
@@ -717,7 +717,7 @@ class ContentObjectRenderer {
                                $GLOBALS['TT']->push($TSkey, $name);
                        }
                        // Checking if the COBJ is a reference to another object. (eg. name of 'blabla.blabla = < styles.something')
-                       if ($name{0} === '<') {
+                       if ($name[0] === '<') {
                                $key = trim(substr($name, 1));
                                $cF = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\TypoScript\\Parser\\TypoScriptParser');
                                // $name and $conf is loaded with the referenced values.
@@ -4218,7 +4218,7 @@ class ContentObjectRenderer {
                        list($tagName) = explode(' ', $subparts[0], 2);
                        // adds/overrides attributes
                        foreach ($conf as $pkey => $val) {
-                               if (substr($pkey, -1) != '.' && substr($pkey, 0, 1) != '_') {
+                               if (substr($pkey, -1) !== '.' && $pkey[0] !== '_') {
                                        $tmpVal = isset($conf[$pkey . '.']) ? $this->stdWrap($conf[$pkey], $conf[$pkey . '.']) : (string)$val;
                                        if ($lowerCaseAttributes) {
                                                $pkey = strtolower($pkey);
@@ -4894,7 +4894,7 @@ class ContentObjectRenderer {
                                $data = substr($theValue, $pointer, $len);
                                $tag = explode(' ', trim(substr($data, 1, -1)), 2);
                                $tag[0] = strtolower($tag[0]);
-                               if (substr($tag[0], 0, 1) == '/') {
+                               if ($tag[0][0] === '/') {
                                        $tag[0] = substr($tag[0], 1);
                                        $tag['out'] = 1;
                                }
@@ -5010,7 +5010,7 @@ class ContentObjectRenderer {
                        $l = trim($l);
                        $attrib = array();
                        $nWrapped = 0;
-                       if (substr($l, 0, 1) == '<' && substr($l, -1) == '>') {
+                       if ($l[0] === '<' && substr($l, -1) === '>') {
                                $fwParts = explode('>', substr($l, 1), 2);
                                list($tagName, $tagParams) = explode(' ', $fwParts[0], 2);
                                if (!$fwParts[1]) {
@@ -5983,7 +5983,7 @@ class ContentObjectRenderer {
                                                // Query Params:
                                                $addQueryParams = $conf['addQueryString'] ? $this->getQueryArguments($conf['addQueryString.']) : '';
                                                $addQueryParams .= isset($conf['additionalParams.']) ? trim($this->stdWrap($conf['additionalParams'], $conf['additionalParams.'])) : trim($conf['additionalParams']);
-                                               if ($addQueryParams == '&' || substr($addQueryParams, 0, 1) != '&') {
+                                               if ($addQueryParams === '&' || $addQueryParams[0] !== '&') {
                                                        $addQueryParams = '';
                                                }
                                                if ($conf['useCacheHash']) {
@@ -6599,8 +6599,9 @@ class ContentObjectRenderer {
                $lines = GeneralUtility::trimExplode(LF, $params, TRUE);
                foreach ($lines as $val) {
                        $pair = explode('=', $val, 2);
-                       if (!GeneralUtility::inList('#,/', substr(trim($pair[0]), 0, 1))) {
-                               $paramArr[trim($pair[0])] = trim($pair[1]);
+                       $pair[0] = trim($pair[0]);
+                       if (!GeneralUtility::inList('#,/', $pair[0][0])) {
+                               $paramArr[$pair[0]] = trim($pair[1]);
                        }
                }
                return $paramArr;
@@ -6823,7 +6824,7 @@ class ContentObjectRenderer {
         * @todo Define visibility
         */
        public function mergeTSRef($confArr, $prop) {
-               if (substr($confArr[$prop], 0, 1) == '<') {
+               if ($confArr[$prop][0] === '<') {
                        $key = trim(substr($confArr[$prop], 1));
                        $cF = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\TypoScript\\Parser\\TypoScriptParser');
                        // $name and $conf is loaded with the referenced values.
index eeb3a5a..fc6cfb1 100644 (file)
@@ -154,7 +154,7 @@ class FormContentObject extends \TYPO3\CMS\Frontend\ContentObject\AbstractConten
                                // field:
                                $fParts = explode(',', $parts[1]);
                                $fParts[0] = trim($fParts[0]);
-                               if (substr($fParts[0], 0, 1) == '*') {
+                               if ($fParts[0][0] === '*') {
                                        $confData['required'] = 1;
                                        $fParts[0] = substr($fParts[0], 1);
                                }
@@ -279,7 +279,7 @@ class FormContentObject extends \TYPO3\CMS\Frontend\ContentObject\AbstractConten
                                                for ($a = 0; $a < $pCount; $a++) {
                                                        $valueParts[$a] = trim($valueParts[$a]);
                                                        // Finding default value
-                                                       if (substr($valueParts[$a], 0, 1) == '*') {
+                                                       if ($valueParts[$a][0] === '*') {
                                                                $sel = 'selected';
                                                                $valueParts[$a] = substr($valueParts[$a], 1);
                                                        } else {
@@ -325,7 +325,7 @@ class FormContentObject extends \TYPO3\CMS\Frontend\ContentObject\AbstractConten
                                                $pCount = count($valueParts);
                                                for ($a = 0; $a < $pCount; $a++) {
                                                        $valueParts[$a] = trim($valueParts[$a]);
-                                                       if (substr($valueParts[$a], 0, 1) == '*') {
+                                                       if ($valueParts[$a][0] === '*') {
                                                                $sel = 'checked';
                                                                $valueParts[$a] = substr($valueParts[$a], 1);
                                                        } else {
index 3cd93f7..409bf05 100644 (file)
@@ -45,7 +45,7 @@ class MediaContentObject extends \TYPO3\CMS\Frontend\ContentObject\AbstractConte
                $content = '';
                // Add flex parameters to configuration
                $flexParams = isset($conf['flexParams.']) ? $this->cObj->stdWrap($conf['flexParams'], $conf['flexParams.']) : $conf['flexParams'];
-               if (substr($flexParams, 0, 1) === '<') {
+               if ($flexParams[0] === '<') {
                        // It is a content element rather a TS object
                        $flexParams = \TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($flexParams, 'T3');
                        foreach ($flexParams['data'] as $sheetData) {
@@ -138,7 +138,7 @@ class MediaContentObject extends \TYPO3\CMS\Frontend\ContentObject\AbstractConte
                                                $tmp = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(LF, $rawTS);
                                                if (count($tmp)) {
                                                        foreach ($tmp as $tsLine) {
-                                                               if (substr($tsLine, 0, 1) != '#' && ($pos = strpos($tsLine, '.'))) {
+                                                               if ($tsLine[0] !== '#' && ($pos = strpos($tsLine, '.'))) {
                                                                        $parts[0] = substr($tsLine, 0, $pos);
                                                                        $parts[1] = substr($tsLine, $pos + 1);
                                                                        $valueParts = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode('=', $parts[1], TRUE);
index dfdbf80..ca4c60b 100644 (file)
@@ -476,7 +476,7 @@ class PageGenerator {
                                        }
                                        if ($ss) {
                                                if ($GLOBALS['TSFE']->pSetup['includeCSS.'][$key . '.']['import']) {
-                                                       if (!$GLOBALS['TSFE']->pSetup['includeCSS.'][($key . '.')]['external'] && substr($ss, 0, 1) != '/') {
+                                                       if (!$GLOBALS['TSFE']->pSetup['includeCSS.'][($key . '.')]['external'] && $ss[0] !== '/') {
                                                                // To fix MSIE 6 that cannot handle these as relative paths (according to Ben v Ende)
                                                                $ss = GeneralUtility::dirname(GeneralUtility::getIndpEnv('SCRIPT_NAME')) . '/' . $ss;
                                                        }
index 65b0f25..dbc3b9f 100644 (file)
@@ -618,7 +618,7 @@ class PageRepository {
                        // If relative path, prefix Site URL:
                        $uI = parse_url($redirectTo);
                        // Relative path assumed now.
-                       if (!$uI['scheme'] && substr($redirectTo, 0, 1) != '/') {
+                       if (!$uI['scheme'] && $redirectTo[0] !== '/') {
                                $redirectTo = GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . $redirectTo;
                        }
                        return $redirectTo;
index 8d396cf..0411c13 100644 (file)
@@ -104,7 +104,7 @@ class DoubleMetaPhoneUtility {
                        $this->current++;
                }
                // Initial 'X' is pronounced 'Z' e.g. 'Xavier'
-               if (substr($this->original, 0, 1) == 'X') {
+               if ($this->original[0] === 'X') {
                        $this->primary .= 'S';
                        // 'Z' maps to 'S'
                        $this->secondary .= 'S';
@@ -223,7 +223,7 @@ class DoubleMetaPhoneUtility {
                                                break;
                                        }
                                        // double 'C', but not McClellan'
-                                       if ($this->StringAt($this->original, $this->current, 2, array('CC')) && !($this->current == 1 && substr($this->original, 0, 1) == 'M')) {
+                                       if ($this->StringAt($this->original, $this->current, 2, array('CC')) && !($this->current == 1 && $this->original[0] === 'M')) {
                                                // 'bellocchio' but not 'bacchus'
                                                if ($this->StringAt($this->original, $this->current + 2, 1, array('I', 'E', 'H')) && !$this->StringAt($this->original, ($this->current + 2), 2, array('HU'))) {
                                                        // 'accident', 'accede', 'succeed'
index a62e2e8..024344d 100644 (file)
@@ -49,7 +49,7 @@ class RootNode extends DirectoryNode implements RootNodeInterface {
 
                if (!isset($structure['name'])
                        || ($this->isWindowsOs() && substr($structure['name'], 1, 2) !== ':/')
-                       || (!$this->isWindowsOs() && substr($structure['name'], 0, 1) !== '/')
+                       || (!$this->isWindowsOs() && $structure['name'][0] !== '/')
                ) {
                        throw new \TYPO3\CMS\Install\FolderStructure\Exception\InvalidArgumentException(
                                'Root node expects absolute path as name',
index bab0800..6c6f4e0 100644 (file)
@@ -77,7 +77,7 @@ class SqlSchemaMigrationService {
                $table = '';
                $total = array();
                foreach ($lines as $value) {
-                       if (substr($value, 0, 1) == '#') {
+                       if ($value[0] === '#') {
                                // Ignore comments
                                continue;
                        }
@@ -91,7 +91,7 @@ class SqlSchemaMigrationService {
                                        }
                                }
                        } else {
-                               if (substr($value, 0, 1) == ')' && substr($value, -1) == ';') {
+                               if ($value[0] === ')' && substr($value, -1) === ';') {
                                        $ttype = array();
                                        if (preg_match('/(ENGINE|TYPE)[ ]*=[ ]*([a-zA-Z]*)/', $value, $ttype)) {
                                                $total[$table]['extra']['ENGINE'] = $ttype[2];
@@ -515,17 +515,18 @@ class SqlSchemaMigrationService {
                $statementArray = array();
                $statementArrayPointer = 0;
                foreach ($sqlcodeArr as $line => $lineContent) {
+                       $lineContent = trim($lineContent);
                        $is_set = 0;
                        // Auto_increment fields cannot have a default value!
                        if (stristr($lineContent, 'auto_increment')) {
                                $lineContent = preg_replace('/ default \'0\'/i', '', $lineContent);
                        }
-                       if (!$removeNonSQL || trim($lineContent) !== '' && substr(trim($lineContent), 0, 1) != '#' && substr(trim($lineContent), 0, 2) != '--') {
+                       if (!$removeNonSQL || $lineContent !== '' && $lineContent[0] !== '#' && substr($lineContent, 0, 2) !== '--') {
                                // '--' is seen as mysqldump comments from server version 3.23.49
                                $statementArray[$statementArrayPointer] .= $lineContent;
                                $is_set = 1;
                        }
-                       if (substr(trim($lineContent), -1) == ';') {
+                       if (substr($lineContent, -1) === ';') {
                                if (isset($statementArray[$statementArrayPointer])) {
                                        if (!trim($statementArray[$statementArrayPointer]) || $query_regex && !preg_match(('/' . $query_regex . '/i'), trim($statementArray[$statementArrayPointer]))) {
                                                unset($statementArray[$statementArrayPointer]);
index 05e15ba..320e42a 100644 (file)
@@ -372,10 +372,10 @@ class LanguageService {
                                                        $type = $keyParts[1];
                                                }
                                                        // Detecting 'hidden' labels, converting to normal fieldname
-                                               if ($fieldName == '_') {
+                                               if ($fieldName === '_') {
                                                        $fieldName = '';
                                                }
-                                               if (substr($fieldName, 0, 1) == '_') {
+                                               if ($fieldName !== '' && $fieldName[0] === '_') {
                                                        $fieldName = substr($fieldName, 1);
                                                }
                                                        // Append label
index 63b73b1..62bc4ef 100644 (file)
@@ -40,7 +40,7 @@ class Ter extends \TYPO3\CMS\Extensionmanager\Utility\Connection\TerUtility {
        public function fetchTranslationStatus($extensionKey, $mirrorUrl) {
                $result = FALSE;
                $extPath = \TYPO3\CMS\Core\Utility\GeneralUtility::strtolower($extensionKey);
-               $mirrorUrl .= $extPath{0} . '/' . $extPath{1} . '/' . $extPath . '-l10n/' . $extPath . '-l10n.xml';
+               $mirrorUrl .= $extPath[0] . '/' . $extPath[1] . '/' . $extPath . '-l10n/' . $extPath . '-l10n.xml';
                $remote = \TYPO3\CMS\Core\Utility\GeneralUtility::getURL($mirrorUrl, 0, array(TYPO3_user_agent));
 
                if ($remote !== FALSE) {
@@ -175,7 +175,7 @@ class Ter extends \TYPO3\CMS\Extensionmanager\Utility\Connection\TerUtility {
         */
        protected function fetchTranslation($extensionKey, $language, $mirrorUrl) {
                $extensionPath = \TYPO3\CMS\Core\Utility\GeneralUtility::strtolower($extensionKey);
-               $mirrorUrl .= $extensionPath{0} . '/' . $extensionPath{1} . '/' . $extensionPath .
+               $mirrorUrl .= $extensionPath[0] . '/' . $extensionPath[1] . '/' . $extensionPath .
                        '-l10n/' . $extensionPath . '-l10n-' . $language . '.zip';
                $l10nResponse = \TYPO3\CMS\Core\Utility\GeneralUtility::getURL($mirrorUrl, 0, array(TYPO3_user_agent));
 
index 66b4071..de82ee7 100644 (file)
@@ -114,7 +114,7 @@ class AccessibilityLinkController extends \TYPO3\CMS\Frontend\Plugin\AbstractPlu
                        if ((string)$extKey !== '' && \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded($extKey) && (string)$local !== '') {
                                $newFilename = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($extKey) . $local;
                        }
-               } elseif (substr($filename, 0, 1) != '/') {
+               } elseif ($filename[0] !== '/') {
                        $newFilename = $filename;
                } else {
                        $newFilename = substr($filename, 1);
index 0a03305..5cf4263 100644 (file)
@@ -611,14 +611,14 @@ var selectedDictionary = "' . $this->dictionary . '";
                                                echo '{' . $AspellAnswer . '}';
                                        }
                                        GeneralUtility::unlink_tempfile($tmpFileName);
-                                       if (substr($AspellResultLines['1'], 0, 1) != '*') {
+                                       if ($AspellResultLines['1'][0] !== '*') {
                                                if (!in_array($word, $this->misspelled)) {
                                                        if (sizeof($this->misspelled) != 0) {
                                                                $this->suggestedWords .= ',';
                                                        }
                                                        $suggest = array();
                                                        $suggestions = array();
-                                                       if (substr($AspellResultLines['1'], 0, 1) == '&') {
+                                                       if ($AspellResultLines['1'][0] === '&') {
                                                                $suggestions = GeneralUtility::trimExplode(':', $AspellResultLines['1'], TRUE);
                                                                $suggest = GeneralUtility::trimExplode(',', $suggestions['1'], TRUE);
                                                        }
index 78453d0..ee8164a 100644 (file)
@@ -1310,7 +1310,7 @@ class RteHtmlAreaBase extends \TYPO3\CMS\Backend\Rte\AbstractRte {
                        if ((string)$extKey !== '' && \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded($extKey) && (string)$local !== '') {
                                $newFilename = ($this->is_FE() || $this->isFrontendEditActive() ? \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($extKey) : $this->backPath . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath($extKey)) . $local;
                        }
-               } elseif (substr($filename, 0, 1) != '/') {
+               } elseif ($filename[0] !== '/') {
                        $newFilename = ($this->is_FE() || $this->isFrontendEditActive() ? '' : $this->backPath . '../') . $filename;
                } else {
                        $newFilename = ($this->is_FE() || $this->isFrontendEditActive() ? '' : $this->backPath . '../') . substr($filename, 1);
index 7b1aa19..9c1c616 100644 (file)
@@ -151,7 +151,7 @@ class SaltedPasswordService extends \TYPO3\CMS\Sv\AbstractAuthenticationService
                                // Instanciate default method class
                                $this->objInstanceSaltedPW = \TYPO3\CMS\Saltedpasswords\Salt\SaltFactory::getSaltingInstance(substr($user['password'], 1));
                                // md5
-                               if (substr($user['password'], 0, 1) === 'M') {
+                               if ($user['password'][0] === 'M') {
                                        $validPasswd = $this->objInstanceSaltedPW->checkPassword(md5($password), substr($user['password'], 1));
                                } else {
                                        $validPasswd = $this->objInstanceSaltedPW->checkPassword($password, substr($user['password'], 1));