Project

General

Profile

Actions

Bug #88847

closed

Getting site configuration via TypoScript is not respecting conditions

Added by Philipp Seiler over 5 years ago. Updated almost 5 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Frontend
Target version:
Start date:
2019-07-26
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
9
PHP Version:
7.3
Tags:
pagerenderer,frontend,base,site,configuration,CodingNight
Complexity:
Is Regression:
Sprint Focus:

Description

  • Have a site configuration like:
    rootPageId: 1
    base: 'https://www.website.com/'
    baseVariants:
      - base: 'https://remote-dev.website.com/'
        condition: 'applicationContext == "Development"'
      - base: 'http://local-dev.website.com/'
        condition: 'getenv("LOCAL_DEVELOPMENT") == 1'
  • Try to add <base href=""> to the website header via
    page.headerData.1234 = TEXT
    page.headerData.1234 {
        data = site:base
        wrap = <base href="|">
    }
  • When visiting https://remote-dev.website.com/, the base-tag will be filled with http://local-dev.website.com/ => Incorrect.
  • Reason is, that within the ContentObjectRenderer in the getData method the site configuration is extracted via Array-Path site:baseVariants.0.base.
  • It simply takes the first base variant available, not respecting conditions in any way.
  • Result is, that all links are broken, as the base-tag is incorrect.
  • Getting site configuration in that way should respect the whole configuration including conditions like everywhere else.
  • I thought that the SEO-Extension had the same problem with creating the canonical-tag. However, the link there is created differently via generateUri method of the PageRouter.

Current workaround is to put reverse the order of the baseVariants and add additional conditions to check for local development and/or remote development.


Files

88847.diff (2.88 KB) 88847.diff Guido Schmechel, 2019-07-26 11:26
Actions #1

Updated by Guido Schmechel over 5 years ago

Can confirm it for the ContentObjectRenderer.

The problem is that the array is simply read out. In the case of the baseUrl there is the extra array "baseVariants", which is ignored. There is a corresponding function in Site Class.

I apply a simple patch. With these small changes I came to a positive result. I'll push the patch and then we'll see if the way is right.

Btw: I did not notice problems with CanonicalTag.

Actions #2

Updated by Gerrit Code Review over 5 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/61375

Actions #3

Updated by Gerrit Code Review over 5 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/61375

Actions #4

Updated by Gerrit Code Review over 5 years ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/61375

Actions #5

Updated by Susanne Moog over 5 years ago

  • Tags changed from pagerenderer,frontend,base,site,configuration to pagerenderer,frontend,base,site,configuration,CodingNight
Actions #6

Updated by Susanne Moog over 5 years ago

  • Target version set to next-patchlevel
Actions #7

Updated by Gerrit Code Review over 5 years ago

Patch set 1 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/61461

Actions #8

Updated by Guido Schmechel over 5 years ago

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

Updated by Gerrit Code Review over 5 years ago

  • Status changed from Resolved to Under Review

Patch set 2 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/61461

Actions #10

Updated by Guido Schmechel over 5 years ago

  • Status changed from Under Review to Resolved
Actions #11

Updated by Benni Mack almost 5 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF