[TYPO3-core] RFC #15246: Use t3lib_div::getIndpEnv('SCRIPT_FILENAME') to determine PATH_thisScript

Dmitry Dulepov dmitry at typo3.org
Tue Jul 27 13:34:31 CEST 2010


Hi!

Nikolas Hagelstein wrote:
> Problem:
> Currently PATH_thisScript is checked/defined in several files using a
> pretty ugly "monster clause chain"
> 
> Changing this to t3lib_div::getIndpEnv('SCRIPT_FILENAME') makes things
> more readable and maintainable.
> 
> Solution:
> Replace "monster clause" by t3lib_div::getIndpEnv('SCRIPT_FILENAME')

I made a quick search and discovered that this change may break script path
detection. Here is what I found quickly.

SCRIPT_FILENAME is non–standard. CGI spec [1] does not have this variable,
so it is possible that your solution will not work in cgi mode.

SCRIPT_FILENAME under MS IIS returns a string with backward slashes. Web
also indicates that this variable may not exist when php runs as cgi under
MS IIS. I did not check any Windows versions myself. The information comes
from comments on php.net.

Under certain condition you can get a path to the PHP interpreter in this
variable ([2]).

Some editions of Ubuntu seem to discard SCRIPT_FILENAME completely ([3]).

[1] http://www.rfc-editor.org/rfc/rfc3875.txt
[2]
http://www.bigresource.com/PHP--_SERVER-SCRIPT_FILENAME-php-php-exe--EziQEXuQ.html
[3] http://community.activestate.com/faq/cgi-debugging-no-input-fi#comment-811

-- 
Dmitry Dulepov
TYPO3 core&security teams member
Twitter: http://twitter.com/dmitryd
Read more @ http://dmitry-dulepov.com/


More information about the TYPO3-team-core mailing list