Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
4c32353
[TASK] Use int for makeHTML property in Nimut\Hellurl\Hooks\DataHandl…
IchHabRecht Jan 23, 2017
d8f5a18
[TASK] Fix wrong type hint for $enableDevLog in Nimut\Hellurl\Hooks\U…
IchHabRecht Jan 23, 2017
2c764e7
[TASK] Add missing property $enableChashUrlDebug in Nimut\Hellurl\Hoo…
IchHabRecht Jan 23, 2017
a77e104
[TASK] Allow null for $mimeType in Nimut\Hellurl\Hooks\UrlRewritingHook
IchHabRecht Jan 23, 2017
5b6954b
[TASK] Fix method returns in Nimut\Hellurl\Hooks\UrlRewritingHook
IchHabRecht Jan 23, 2017
2c08a9c
[TASK] Fix argument casting in Nimut\Hellurl\Hooks\UrlRewritingHook
IchHabRecht Jan 23, 2017
9772503
[TASK] Fix argument casting in Nimut\Hellurl\UriGeneratorAndResolver
IchHabRecht Jan 23, 2017
2083712
[TASK] Fix undefined variable in Nimut\Hellurl\UriGeneratorAndResolver
IchHabRecht Jan 23, 2017
85c83f2
[TASK] Fix method returns in Nimut\Hellurl\UriGeneratorAndResolver
IchHabRecht Jan 23, 2017
bcc7c34
[TASK] Add phpstan code analysis for multiple TYPO3 versions
IchHabRecht Jan 23, 2017
f7afa84
[TASK] Use $GLOBALS['BACK_PATH'] instead of undefined property in Nim…
IchHabRecht Jan 23, 2017
7b90628
[TASK] Fix argument casting in Nimut\Hellurl\View\AdministrationModul…
IchHabRecht Jan 23, 2017
9e3c471
[TASK] Fix undefined variable in Nimut\Hellurl\ViewHelpers\PageBrowse…
IchHabRecht Jan 23, 2017
defe8ef
[TASK] Fix method return in Nimut\Hellurl\UriGeneratorAndResolver
IchHabRecht Jan 23, 2017
0f86be6
[TASK] Fix unknown class in Nimut\Hellurl\Configuration\Configuration…
IchHabRecht Jan 23, 2017
1c64610
[TASK] Prevent to call undefined method in Nimut\Hellurl\Hooks\UrlRew…
IchHabRecht Jan 23, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,18 @@ matrix:
- php: 5.4
- php: 5.3
- php: 7.0
env: CODE_ANALYSIS=yes
env: TYPO3="dev-master as 8.5.0" CODE_ANALYSIS=yes
- php: 7.0
env: TYPO3=^8.0 CODE_ANALYSIS=yes
- php: 7.0
env: TYPO3=^7.6 CODE_ANALYSIS=yes
- php: 7.0
env: TYPO3=^6.2 CODE_ANALYSIS=yes
allow_failures:
- env: CODE_ANALYSIS=yes
- env: TYPO3="dev-master as 8.5.0" CODE_ANALYSIS=yes
- env: TYPO3=^8.0 CODE_ANALYSIS=yes
- env: TYPO3=^7.6 CODE_ANALYSIS=yes
- env: TYPO3=^6.2 CODE_ANALYSIS=yes

addons:
apt:
Expand All @@ -28,7 +37,7 @@ script:

- >
if [[ "$CODE_ANALYSIS" == "yes" ]]; then
composer require typo3/cms="^7.6"
composer require typo3/cms="$TYPO3" --ignore-platform-reqs
git checkout composer.json
.Build/bin/phpstan analyse --level 5 ext_localconf.php ext_tables.php Classes
fi
5 changes: 3 additions & 2 deletions Classes/Configuration/ConfigurationGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/

use TYPO3\CMS\Core\Locking\LockingStrategyInterface;
use TYPO3\CMS\Core\Utility\GeneralUtility;

/**
Expand Down Expand Up @@ -58,9 +57,11 @@ public function generateConfiguration()
$fileName = PATH_site . self::AUTOCONFIGURTION_FILE;
if (class_exists('TYPO3\\CMS\\Core\\Locking\\LockFactory')) {
$lockFactory = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Locking\\LockFactory');
$capabilities = constant('TYPO3\\CMS\\Core\\Locking\\LockingStrategyInterface::LOCK_CAPABILITY_EXCLUSIVE')
| constant('TYPO3\\CMS\\Core\\Locking\\LockingStrategyInterface::LOCK_CAPABILITY_NOBLOCK');
$lockObject = $lockFactory->createLocker(
$fileName,
LockingStrategyInterface::LOCK_CAPABILITY_EXCLUSIVE | LockingStrategyInterface::LOCK_CAPABILITY_NOBLOCK
$capabilities
);
$lockObject->acquire();
} else {
Expand Down
2 changes: 1 addition & 1 deletion Classes/Hooks/DataHandling/DataHandlerHook.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ protected function getChildPages($pageId)
/** @var $tree \TYPO3\CMS\Backend\Tree\View\PageTreeView */
$tree = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Tree\\View\\PageTreeView');
$tree->init('AND ' . $GLOBALS['BE_USER']->getPagePermsClause(1));
$tree->makeHTML = false;
$tree->makeHTML = 0;
$tree->getTree($pageId, 99, '');

foreach ($tree->tree as $data) {
Expand Down
39 changes: 25 additions & 14 deletions Classes/Hooks/UrlRewritingHook.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class UrlRewritingHook implements SingletonInterface
/**
* Indicates whether devLog is enabled
*
* @var true
* @var bool
*/
protected $enableDevLog = false;

Expand All @@ -137,14 +137,25 @@ class UrlRewritingHook implements SingletonInterface
/**
* Mime type that can be set according to the file extension (decoding only).
*
* @var string
* @var string|null
*/
protected $mimeType = null;

public $enableStrictMode = false;

/**
* @var bool
*/
public $enableChashDebug = false;

/**
* @var bool
*/
protected $enableChashUrlDebug = false;

/**
* @var bool
*/
public $enableStrictMode = false;

/**
* If non-empty, corresponding URL query parameter will be ignored in preVars
* (note: preVars only!). This is necessary for _DOMAINS feature. This value
Expand Down Expand Up @@ -1022,7 +1033,7 @@ public function decodeSpURL($params)
$cachedInfo['GET_VARS']['id'] = $cachedInfo['id'];
$_SERVER['QUERY_STRING'] = $this->decodeSpURL_createQueryString($cachedInfo['GET_VARS']);
if (is_callable('TYPO3\\CMS\\Core\\Utility\\GeneralUtility::flushInternalRuntimeCaches')) {
GeneralUtility::flushInternalRuntimeCaches();
call_user_func('TYPO3\\CMS\\Core\\Utility\\GeneralUtility::flushInternalRuntimeCaches');
}

// Jump-admin if configured
Expand Down Expand Up @@ -1339,7 +1350,7 @@ protected function decodeSpURL_settingPreVars(&$pathParts, $config)
return $GET_VARS;
}
}
return null;
return array();
}

/**
Expand Down Expand Up @@ -1410,7 +1421,7 @@ protected function decodeSpURL_settingPostVarSets(&$pathParts, $postVarSetCfg, $
return $GET_VARS;
}
}
return null;
return array();
}

/**
Expand Down Expand Up @@ -1948,7 +1959,7 @@ protected function decodeSpURL_cHashCache($speakingURIpath)
* @param string $value Value to match field in database to.
* @param bool $aliasToUid If TRUE, the input $value is an alias-string that needs translation to an ID integer. FALSE (default) means the reverse direction
*
* @return string Result value of lookup. If no value was found the $value is returned.
* @return int|string Result value of lookup. Either an int value (id) or a string (alias). If no value was found the $value is returned.
*/
protected function lookUpTranslation($cfg, $value, $aliasToUid = false)
{
Expand Down Expand Up @@ -2036,7 +2047,7 @@ protected function lookUpTranslation($cfg, $value, $aliasToUid = false)
if ($csConvObj->strlen('utf-8', $aliasValue) > $maximumAliasLength) {
$aliasValue = $csConvObj->crop('utf-8', $aliasValue, $maximumAliasLength);
}
return $this->lookUp_newAlias($cfg, $aliasValue, $value, $lang);
return $this->lookUp_newAlias($cfg, $aliasValue, (int)$value, $lang);
} // If no cache for alias, then just return whatever value is appropriate:
if (strlen($row[$cfg['alias_field']]) <= $maximumAliasLength) {
return $row[$cfg['alias_field']];
Expand Down Expand Up @@ -2082,7 +2093,7 @@ protected function lookUp_uniqAliasToId($cfg, $aliasValue, $onlyNonExpired = fal
* @param int $lang sys_language_uid to use for lookup
* @param string $aliasValue Optional alias value to limit search to
*
* @return string Alias string. If none is found: false
* @return string|null Alias string. If none is found: null
* @see lookUpTranslation(), lookUp_uniqAliasToId()
*/
protected function lookUp_idToUniqAlias($cfg, $idValue, $lang, $aliasValue = '')
Expand Down Expand Up @@ -2124,7 +2135,7 @@ protected function lookUp_newAlias($cfg, $newAliasValue, $idValue, $lang)
$newAliasValue = $this->lookUp_cleanAlias($cfg, $newAliasValue);

// If autoupdate is true we might be here even if an alias exists. Therefore we check if that alias is the $newAliasValue and if so, we return that instead of making a new, unique one.
if ($cfg['autoUpdate'] && $this->lookUp_idToUniqAlias($cfg, $idValue, $lang, $newAliasValue)) {
if ($cfg['autoUpdate'] && $this->lookUp_idToUniqAlias($cfg, (string)$idValue, $lang, $newAliasValue)) {
return $newAliasValue;
}

Expand Down Expand Up @@ -2163,7 +2174,7 @@ protected function lookUp_newAlias($cfg, $newAliasValue, $idValue, $lang)
);

// Checking that this alias hasn't been stored since we looked last time
$returnAlias = $this->lookUp_idToUniqAlias($cfg, $idValue, $lang, $uniqueAlias);
$returnAlias = $this->lookUp_idToUniqAlias($cfg, (string)$idValue, $lang, $uniqueAlias);
if ($returnAlias) {
// If we are here it is because another process managed to create this alias in the time between we looked the first time and now when we want to put it in database.
$uniqueAlias = $returnAlias;
Expand Down Expand Up @@ -2349,7 +2360,7 @@ protected function getHost()
/**
* Returns configuration for a postVarSet (default) based on input page id
*
* @param int $pageId Page id
* @param int|string $pageId Page id or alias
* @param string $mainCat Main key in hellurl configuration array. Default is "postVarSets" but could be "fixedPostVars"
*
* @return array Configuration array
Expand All @@ -2360,7 +2371,7 @@ public function getPostVarSetConfig($pageId, $mainCat = 'postVarSets')
{
// If the page id is NOT an integer, it's an alias we have to look up
if (!MathUtility::canBeInterpretedAsInteger($pageId)) {
$pageId = $this->pageAliasToID($pageId);
$pageId = $this->pageAliasToID((string)$pageId);
}

// Checking if the value is not an array but a pointer to another key
Expand Down
30 changes: 14 additions & 16 deletions Classes/UriGeneratorAndResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ private function resolveAlias($pageId)
*/
protected function isExcludedPage($pageId)
{
return $this->conf['excludePageIds'] && GeneralUtility::inList($this->conf['excludePageIds'], $pageId);
return $this->conf['excludePageIds'] && GeneralUtility::inList($this->conf['excludePageIds'], (string)$pageId);
}

/**
Expand All @@ -197,7 +197,7 @@ protected function mergeWithPathParts(array &$pathParts, $pagePath)
* Resolves shortcuts if necessary and returns the final destination page id.
*
* @param int $pageId
* @param array $mpvar
* @param string $mpvar
*
* @return mixed false if not found or int
*/
Expand Down Expand Up @@ -280,8 +280,8 @@ protected function createPagePathAndUpdateURLCache($id, $mpvar, $lang, $cachedPa
* Adds a new entry to the path cache.
*
* @param int $pageId
* @param int $cachedPagePath
* @param int $pagePath
* @param string $cachedPagePath
* @param string $pagePath
* @param int $langId
* @param int $rootPageId
* @param string $mpvar
Expand All @@ -291,7 +291,7 @@ protected function createPagePathAndUpdateURLCache($id, $mpvar, $lang, $cachedPa
private function updateURLCache($pageId, $cachedPagePath, $pagePath, $langId, $rootPageId, $mpvar)
{
$canCachePaths = !$this->conf['disablePathCache'] && !$this->pObj->isBEUserLoggedIn();
$newPathDiffers = ((string)$pagePath !== (string)$cachedPagePath);
$newPathDiffers = $pagePath !== $cachedPagePath;
if ($canCachePaths && $newPathDiffers) {
/** @noinspection PhpUndefinedMethodInspection */
$cacheCondition = 'page_id=' . intval($pageId) .
Expand Down Expand Up @@ -528,7 +528,7 @@ protected function IDtoPagePathSegments($id, $mpvar, $langID)
}
if (!$rootFound) {
// Pass #2 -- check normal page
$this->pObj->devLog('Starting to walk rootline for id=' . $id . ' from index=' . $i, $rootLine);
$this->pObj->devLog('Starting to walk rootline for id=' . $id . ' from index=0 to ' . $numberOfRootlineEntries, $rootLine);
for ($i = 0; $i < $numberOfRootlineEntries; $i++) {
if ($GLOBALS['TSFE']->tmpl->rootLine[0]['uid'] == $rootLine[$i]['uid']) {
$this->pObj->devLog('Found rootline', array('uid' => $id, 'rootline start pid' => $rootLine[$i]['uid']));
Expand Down Expand Up @@ -628,7 +628,7 @@ protected function rootLineToPath($rl, $lang)
// Building up the path from page title etc.
if (!$page['tx_hellurl_exclude'] || count($rl) == 0) {
// List of "pages" fields to traverse for a "directory title" in the speaking URL (only from RootLine!!)
$segTitleFieldArray = GeneralUtility::trimExplode(',', $this->conf['segTitleFieldList'] ? $this->conf['segTitleFieldList'] : TX_HELLURL_SEGTITLEFIELDLIST_DEFAULT, 1);
$segTitleFieldArray = GeneralUtility::trimExplode(',', $this->conf['segTitleFieldList'] ? $this->conf['segTitleFieldList'] : TX_HELLURL_SEGTITLEFIELDLIST_DEFAULT, true);
$theTitle = '';
foreach ($segTitleFieldArray as $fieldName) {
if (isset($page[$fieldName]) && $page[$fieldName] !== '') {
Expand Down Expand Up @@ -656,7 +656,7 @@ protected function rootLineToPath($rl, $lang)
*
* @param array $pathParts Array of segments from virtual path
*
* @return int Page ID
* @return array Page ID and GET_VARS
* @see decodeSpURL_idFromPath()
*/
protected function pagePathtoID(&$pathParts)
Expand Down Expand Up @@ -946,17 +946,15 @@ protected function fetchPagesForPath($url)
* @param int $startPid Page id in which to search subpages matching first part of urlParts
* @param string $mpvar MP variable string
* @param array $urlParts Segments of the virtual path (passed by reference; items removed)
* @param array|string $currentIdMp Array with the current pid/mpvar to return if no processing is done.
* @param array|null $currentIdMp Array with the current pid/mpvar to return if no processing is done.
* @param bool $foundUID
*
* @return array With resolved id and $mpvar
*/
protected function findIDBySegment($startPid, $mpvar, array &$urlParts, $currentIdMp = '', $foundUID = false)
protected function findIDBySegment($startPid, $mpvar, array &$urlParts, $currentIdMp = null, $foundUID = false)
{
// Creating currentIdMp variable if not set
if (!is_array($currentIdMp)) {
$currentIdMp = array($startPid, $mpvar, $foundUID);
}
$currentIdMp = ($currentIdMp !== null) ? $currentIdMp : array($startPid, $mpvar, $foundUID);

// No more urlparts? Return what we have.
if (count($urlParts) == 0) {
Expand Down Expand Up @@ -1004,7 +1002,7 @@ protected function findIDBySegment($startPid, $mpvar, array &$urlParts, $current
* when excluded segment is found
*
* @param array $row Row to process
* @param array $mpvar MP var
* @param string $mpvar MP var
* @param array $urlParts URL segments
* @param bool $foundUID
*
Expand Down Expand Up @@ -1045,7 +1043,7 @@ protected function findPageBySegmentAndPid($searchPid, $title)
// List of "pages" fields to traverse for a "directory title" in the speaking URL (only from RootLine!!)
$segTitleFieldList = $this->conf['segTitleFieldList'] ? $this->conf['segTitleFieldList'] : TX_HELLURL_SEGTITLEFIELDLIST_DEFAULT;
$selList = GeneralUtility::uniqueList('uid,pid,doktype,mount_pid,mount_pid_ol,tx_hellurl_exclude,' . $segTitleFieldList);
$segTitleFieldArray = GeneralUtility::trimExplode(',', $segTitleFieldList, 1);
$segTitleFieldArray = GeneralUtility::trimExplode(',', $segTitleFieldList, true);

// page select object - used to analyse mount points.
$sys_page = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Page\\PageRepository');
Expand Down Expand Up @@ -1223,7 +1221,7 @@ public function encodeTitle($title)
*
* @param int $offsetFromNow Offset to expiration
*
* @return int Expiration time stamp
* @return int|string Expiration timestamp or SQL string if adodb is loaded
*/
protected function makeExpirationTime($offsetFromNow = 0)
{
Expand Down
Loading