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

Ingmar Schlecht ingmar at typo3.org
Wed Nov 14 00:04:04 CET 2007


Hi guys,

this was a long discussion but didn't have a result.

Can somebody involved please write a final patch?

cheers
Ingmar


Martin Kutschker wrote:
> 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);
> 
> Masi
> 
> PS: It's not that complicated ;-)


More information about the TYPO3-team-core mailing list