Bug #24528
closedgetViewDomain returns "http://" when called with id = 0 and existing sys_domain rec -> "Generate Workspace Preview Link" broken
0%
Description
The bug will probably only be seen in the "old" workspace module when the button "Generate Workspace Preview Link" is used.
With #19430 the API method t3lib_BEfunc::getViewDomain($this->id) is used to determine the right domain for the preview link for a whole workspace (previously: TYPO3_SITE_URL). This works only if $this->id is > 0 like described in the param documentation or no domain record is configured. Since that module is not in the "web"-area, there is no page tree and so no id. -> id = 0
Effects of calling getViewDomain with id = 0:
If parameter $rootline is also not used, the function BEgetRootLine is called and creates some "fake" rootline for id = 0
If you have a domain record configured, the next check for getDomainStartPage returns true, but with the faked rootline, there will be no "firstDomainRecord" and so the $domain is overwritten with a blank string.
Solution: only try to resolve the domain from domain records if the id is > 0, otherwise just return the TYPO3_SITE_URL
How to reproduce: open workspace module in 4.4.6 / 4.4 trunk and generate a preview link. There must also exist a domain record for the your current host.
You will get something like this: http://index.php/?ADMCMD_prev=316906209b748eafb0eb631a57b3450f&id=0
Apply the patch, and you will get: http://www.example.com/index.php/?ADMCMD_prev=316906209b748eafb0eb631a57b3450f&id=0
To fix that particular case, the patch would only need to go to 4.4, but it would probably not hurt in 4.5 either.
(issue imported from #M16983)
Files