[TYPO3-core] RFC: PATH_thisScript definition cleanup

Simon Strandgaard neoneye at gmail.com
Fri Jun 25 16:40:01 CEST 2010


I have created an issue for it here:
http://bugs.typo3.org/view.php?id=14873



Description below
-------------------------
One of the first pieces of code in typo3_src/index.php is used
(inconsistently) several other places in the typo3 codebase.

define('PATH_thisScript',str_replace('//','/', str_replace('\\','/',
(PHP_SAPI=='cgi'||PHP_SAPI=='isapi'
||PHP_SAPI=='cgi-fcgi')&&($_SERVER['ORIG_PATH_TRANSLATED']?$_SERVER['ORIG_PATH_TRANSLATED']:$_SERVER['PATH_TRANSLATED'])?
($_SERVER['ORIG_PATH_TRANSLATED']?$_SERVER['ORIG_PATH_TRANSLATED']:$_SERVER['PATH_TRANSLATED']):($_SERVER['ORIG_SCRIPT_FILENAME']?$_SERVER['ORIG_SCRIPT_FILENAME']:$_SERVER['SCRIPT_FILENAME']))));


I think I had to use isset() in some ajax code for it to work, like this.

define('PATH_thisScript',str_replace('//','/', str_replace('\\','/',
(PHP_SAPI=='cgi'||PHP_SAPI=='isapi'
||PHP_SAPI=='cgi-fcgi')&&(isset($_SERVER['ORIG_PATH_TRANSLATED'])?$_SERVER['ORIG_PATH_TRANSLATED']:$_SERVER['PATH_TRANSLATED'])?
(isset($_SERVER['ORIG_PATH_TRANSLATED'])?$_SERVER['ORIG_PATH_TRANSLATED']:$_SERVER['PATH_TRANSLATED']):(isset($_SERVER['ORIG_SCRIPT_FILENAME'])?$_SERVER['ORIG_SCRIPT_FILENAME']:$_SERVER['SCRIPT_FILENAME']))));


It solved a nasty php error that I had
PHP Notice: Undefined index: ORIG_SCRIPT_FILENAME in
/some/long/path/file.php on line 1234,
referer: http://example.com/index.php?id=4321
-------------------------




I was told to post my message here on the typo3 english list.


-- 
Best regards
Simon Strandgaard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.typo3.org/pipermail/typo3-team-core/attachments/20100625/9fd5ca55/attachment-0001.htm>


More information about the TYPO3-team-core mailing list