[TYPO3-core] RFC: Bug / Feature #5838: Get cli_dispatch.phpsh to work on windows platforms

Martin Kutschker martin.kutschker-n0spam at no5pam-blackbox.net
Thu Feb 14 16:28:55 CET 2008


Martin Kutschker schrieb:
> Andreas Otto schrieb:
>> Hi Martin,
>>
>> Martin Kutschker wrote:
>>> Please wait a bit, because I'll want to have a closer look a Dmitry's
>>> getcwd() idea.
>>
>> OK.
> 
> This code works on Windows even with relative paths. Note that 
> $_SERVER['PWD'] is used because of getcwd() issues on some *nix systems.
> 
> $relativePath = FALSE;
> if (stristr(PHP_OS,'win')&&!stristr(PHP_OS,'darwin')) {
>   if (!preg_match('/^([A-Z]:)?\\/', $temp_PATH_thisScript)) {
>     $relativePath = TRUE;
>   }
> } else {
>   if ($temp_PATH_thisScript{0} != '/') {
>     $relativePath = TRUE;
>   }
> }
> 
> if ($relativePath) {
>   $wd = $_SERVER['PWD'] ? $_SERVER['PWD'] : getcwd();
>   if ($wd) {
>     $temp_PATH_thisScript =
>       $wd.'/'.ereg_replace('\.\/','',$temp_PATH_thisScript);
>     if (!@is_file($temp_PATH_thisScript)) {
>       die ('relative path found and an error occured during resolving of 
> the absolute path. $temp_PATH_thisScript');
>     }
>   } else {
>     die ('relative path found, but resolving absolute path is not 
> supported on this platform.');
>   }
> }
> define('PATH_thisScript',$temp_PATH_thisScript);

Here is the change as diff. I have also added a copyright claim and the 
SVN tag.

Masi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bug_5838-ws.diff
Type: text/x-diff
Size: 4895 bytes
Desc: not available
Url : http://lists.netfielders.de/pipermail/typo3-team-core/attachments/20080214/7e751a60/attachment.diff 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bug_5838.diff
Type: text/x-diff
Size: 5060 bytes
Desc: not available
Url : http://lists.netfielders.de/pipermail/typo3-team-core/attachments/20080214/7e751a60/attachment-0001.diff 


More information about the TYPO3-team-core mailing list