Actions
Bug #31771
closedWrong "targetDomain" in tslib_cObj::typolink with sys_domain records and different url sheme
Start date:
2011-11-12
Due date:
% Done:
100%
Estimated time:
TYPO3 Version:
4.6
PHP Version:
5.3
Tags:
Complexity:
medium
Is Regression:
Sprint Focus:
Description
If you generate a link with "tslib_cObj::typolink" to a page which has a different domain, typolink() loads the matching domain from sys_domain. But if the target page has a different url scheme (set in page settings) than the current rendered page, then always the current domain will be used!
You can find this issue in line 5788-5792 in "class.tslib_content.php":
// If no domain records are defined, use current domain: if ($targetDomain === '' && $conf['forceAbsoluteUrl'] || $absoluteUrlScheme !== parse_url(t3lib_div::getIndpEnv('TYPO3_REQUEST_URL'), PHP_URL_SCHEME)) { $targetDomain = $currentDomain; }
You have to check for a empty $targetDomain if the target-scheme is different too! Otherwise the correct targetDomain will always be overwritten with the current domain:
You can fix it with some braces to check always for a empty targetDomain:
// If no domain records are defined, use current domain: if ($targetDomain === '' && ($conf['forceAbsoluteUrl'] || $absoluteUrlScheme !== parse_url(t3lib_div::getIndpEnv('TYPO3_REQUEST_URL'), PHP_URL_SCHEME))) { $targetDomain = $currentDomain; }
Actions