Bug #31771
closedWrong "targetDomain" in tslib_cObj::typolink with sys_domain records and different url sheme
100%
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; }
Updated by Steffen Ritter about 13 years ago
- Status changed from New to Accepted
I know about it - stumbled across it myself...
Problem is: we would need a systematic rewrite of the typolink function...
Updated by Steffen Gebert about 13 years ago
But that's such an obvious bug that has to be fixed - independent of a rewrite of typolink.
Updated by Steffen Ritter about 13 years ago
Steffen Gebert wrote:
But that's such an obvious bug that has to be fixed - independent of a rewrite of typolink.
if you see no side effects... I fear about them...
It seems obvious, aber there must have been a reason, to do it like it has been done...
This should be tested in complex multi-domain installations for some time before including it into an release? don't you think so?
Could you give it a try at the FW sites? I would test it within the instances I had the problem myself hoping nothing else would break.
Updated by Dmitry Dulepov about 13 years ago
The proposed change would not work in all cases. The next lines are:
// If go for an absolute link, add site_path if it's not taken care about by absRefPrefix if (!$GLOBALS['TSFE']->config['config']['absRefPrefix'] && $targetDomain !== '') { $targetDomain = $currentDomain . rtrim(t3lib_div::getIndpEnv('TYPO3_SITE_PATH'), '/'); }
So the target domain will be overwritten by the current domain if absRefPrefix is not set.
Updated by Mr. Hudson about 13 years ago
- Status changed from Accepted to Under Review
Patch set 1 of change I1b7f1248f8b62bdaae0adeb114c29f42b146daa4 has been pushed to the review server.
It is available at http://review.typo3.org/6708
Updated by Mr. Hudson about 13 years ago
Patch set 1 of change I11d21d19731c8d5b9337dfef773cb43484a0b291 has been pushed to the review server.
It is available at http://review.typo3.org/6709
Updated by Mr. Hudson about 13 years ago
Patch set 1 of change Iedf2ade4707f41f10a1989b753cb5fc0dcf978a1 has been pushed to the review server.
It is available at http://review.typo3.org/6710
Updated by Mr. Hudson about 13 years ago
Patch set 2 of change I1b7f1248f8b62bdaae0adeb114c29f42b146daa4 has been pushed to the review server.
It is available at http://review.typo3.org/6708
Updated by Mr. Hudson about 13 years ago
Patch set 2 of change I11d21d19731c8d5b9337dfef773cb43484a0b291 has been pushed to the review server.
It is available at http://review.typo3.org/6709
Updated by Mr. Hudson about 13 years ago
Patch set 2 of change Iedf2ade4707f41f10a1989b753cb5fc0dcf978a1 has been pushed to the review server.
It is available at http://review.typo3.org/6710
Updated by Mr. Hudson about 13 years ago
Patch set 3 of change Iedf2ade4707f41f10a1989b753cb5fc0dcf978a1 has been pushed to the review server.
It is available at http://review.typo3.org/6710
Updated by Steffen Ritter almost 13 years ago
- Target version set to 4.7.0-alpha1
Updated by Oliver Hader almost 13 years ago
- Target version changed from 4.7.0-alpha1 to 4.7.0-alpha2
Updated by Gerrit Code Review almost 13 years ago
Patch set 3 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/6708
Updated by Gerrit Code Review almost 13 years ago
Patch set 3 for branch TYPO3_4-6 has been pushed to the review server.
It is available at http://review.typo3.org/6709
Updated by Gerrit Code Review almost 13 years ago
Patch set 4 for branch TYPO3_4-5 has been pushed to the review server.
It is available at http://review.typo3.org/6710
Updated by Dmitry Dulepov almost 13 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset a4fbcc8423a2ac742a250b011007e834d7a9fc6d.
Updated by Ernesto Baschny almost 13 years ago
- Target version changed from 4.7.0-alpha2 to 4.5.11
Updated by Riccardo De Contardi about 7 years ago
- Status changed from Resolved to Closed