Project

General

Profile

Actions

Bug #23145

closed

RealUrl-Decoding does not work because t3lib_div::getIndpEnv("SCRIPT_NAME") return a wrong value on Apache 2.2 / Debian Lenny

Added by Johannes over 14 years ago. Updated over 10 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2010-07-10
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
4.4
PHP Version:
5.2
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

RealUrl encodes URLs, but does not decode them, because $this->pObj->siteScript in tx_realurl::decodeSpURL() returns an empty string. That is because t3lib_div::getIndpEnv("SCRIPT_NAME") returns the requested url instead of the location of index.php.

In my special case, it works with
$retVal = substr($_SERVER['SCRIPT_FILENAME'],strlen($_SERVER ['DOCUMENT_ROOT']) - 1);

The same error already existed in Typo3 v4.2.1 on another Debian Lenny system.

My environment:
Typo3 v4.4.0
RealURL v1.8.1
Debian Lenny
Apache v2.2.9
PHP v5.2.6
(issue imported from #M15074)

Actions #1

Updated by Steffen Ritter over 14 years ago

think you just configured your server wrong, I have plenty of TYPO3 sites on Debian Servers which works like a charm.

Furthermore I'm a bit unsure if this belongs to tx_realurl

Actions #2

Updated by Johannes over 14 years ago

So what could be wrong in the configuration? It is mostly the standard configuration. Additionally, there are the mod_rewrite lines:

RewriteRule ^/cms/(typo3|t3lib|tslib|fileadmin|typo3conf|typo3temp|uploads|showpic\.php|favicon\.ico|index\.php) - [L]
RewriteRule ^/cms/typo3$ typo3/index_re.php [L]
RewriteCond {DOCUMENT_ROOT}{REQUEST_FILENAME} !-f
RewriteCond {DOCUMENT_ROOT}{REQUEST_FILENAME} !-d
RewriteCond {DOCUMENT_ROOT}{REQUEST_FILENAME} !-l
RewriteRule ^/cms/.* /cms/index.php [L]

I tried to review the logic in t3lib_div::getIndpEnv(). The following I got:
TYPO3_SITE_SCRIPT (used in realurl) is build as the difference between TYPO3_REQUEST_URL and TYPO3_SITE_URL
for example
TYPO3_SITE_SCRIPT=path/to/site/ is build from
TYPO3_REQUEST_URL=http://host/cms/path/to/site/ and
TYPO3_SITE_URL=http://host/cms/

TYPO3_SITE_URL itself is build mainly as TYPO3_REQUEST_DIR which is TYPO3_REQUEST_HOST+SCRIPT_NAME
According to http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html , SCRIPT_NAME is the name of the URI before rewriting. As a result, TYPO3_SITE_SCRIPT is always empty, because TYPO3_REQUEST_URL=TYPO3_SITE_URL.
Back to our example, it would be
TYPO3_SITE_URL=http://host/cms/path/to/site/

So i don't know why it works for you, but for me it does not. As I see it, TYPO3_SITE_URL is determined in a wrong way. Maybe it should be something like
$retVal = self::getIndpEnv('TYPO3_REQUEST_HOST').'/'.substr(dirname(self::getIndpEnv('SCRIPT_FILENAME')).'/', strlen($_SERVER['DOCUMENT_ROOT']));
This works for me.

What is different in your environment that this error does not occur?

Actions #3

Updated by Alexander Opitz about 11 years ago

  • Category deleted (Communication)
  • Status changed from New to Needs Feedback
  • Target version deleted (0)
  • Is Regression set to No

Hi,

as this issue is very old. Does the problem still exists within newer versions of TYPO3 CMS (4.5 or 6.1)?

Actions #4

Updated by Alexander Opitz over 10 years ago

  • Status changed from Needs Feedback to Closed

No feedback within the last 90 days => closing this ticket.

If you think that this is the wrong decision or experience this issue again, then please write to the mailing list typo3.teams.bugs with issue number and an explanation or open a new ticket and add a relation to this ticket number.

Actions

Also available in: Atom PDF