Project

General

Profile

Actions

Bug #31771

closed

Wrong "targetDomain" in tslib_cObj::typolink with sys_domain records and different url sheme

Added by Jaume Prat about 13 years ago. Updated about 7 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
-
Target version:
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

Also available in: Atom PDF