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

Christian Trabold christian.trabold at dkd.de
Mon Oct 29 15:56:36 CET 2007


Hi,

first: I made an error in the if-statement. The variable 
"$temp_CURRENT_DIR" should *never* be set on windows machines.


So this would be my desired if-statment:

if (!stristr(PHP_OS,'win')&&stristr(PHP_OS,'darwin'))) {
     $temp_CURRENT_DIR = $_SERVER['PWD'].'/';
}


Sorry for confusing you!


>>>> Do not set $temp_CURRENT_DIR on Windows. See attached patch.
> Probably (I'd have submitted the original one right away), but somebody was nitpicking, so I took the time and tried to make the one solution that is clean and bulletproof.
> 
> And come on, my code isn't that complicated. At least with this one you know what is going on. Which is true for both the code and the output of the program! 

Well, what I can report from one of our customers is, that it seems that 
after the patch everything went perfect.

The script can now be called via absolute path like this:

C:\>php C:/Inetpub/wwwroot/project/typo3/cli_dispatch.phpsh crawler


Before the patch, this error message was thrown:

ERROR: /C:/Inetpub/wwwroot/project/typo3/cli_dispatch.phpsh was not a 
file. ...


Mind this part of the error message:

"ERROR: /C:/
         ^---- This slash is prepended by $temp_CURRENT_DIR


All other tests with different "path-styles" forced PHP-Errors, because 
the t3lib-files could not be included by the require_once-Calls 
following in init.php etc.

Example Path on a network-share:

C:\>php \\localhost\d$\Inetpub\wwwroot\project\typo3\cli_dispatch.phpsh 
crawler


OR


D:\>php /Inetpub/wwwroot/project/typo3/typo3/cli_dispatch.phpsh crawler

Warning: 
t3lib_div::include(/Inetpub/wwwroot/project/typo3conf//Inetpub/wwwroot/project/typo3/sysext/cms/tbl_t
t_content.php): failed to open stream: No such file or directory in 
D:\Inetpub\wwwroot\project\t3lib\class.t3lib_div.php on line 3787

etc.


So IMHO we do NOT need more if-statements to fetch "$_SERVER['PWD']" or 
whatever if there is a simple rule for calling CLI-Scripts on Windows:

1) Always use the absolute path to the script.
2) Do not prepend the path with / (which could be fixed with the 
attached patch)


Greetings

Christian
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 5838_cli_dispatch.phpsh 2.patch
Url: http://lists.netfielders.de/pipermail/typo3-team-core/attachments/20071029/94b27032/attachment.txt 


More information about the TYPO3-team-core mailing list