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 #1

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...

Actions #2

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.

Actions #3

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.

Actions #4

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.

Actions #5

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

Actions #6

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

Actions #7

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

Actions #8

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

Actions #9

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

Actions #10

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

Actions #11

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

Actions #12

Updated by Steffen Ritter almost 13 years ago

  • Target version set to 4.7.0-alpha1
Actions #13

Updated by Oliver Hader almost 13 years ago

  • Target version changed from 4.7.0-alpha1 to 4.7.0-alpha2
Actions #14

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

Actions #15

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

Actions #16

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

Actions #17

Updated by Dmitry Dulepov almost 13 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #18

Updated by Ernesto Baschny almost 13 years ago

  • Target version changed from 4.7.0-alpha2 to 4.5.11
Actions #19

Updated by Riccardo De Contardi about 7 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF