Bug #44000

Flow CLI on Windows does not work anymore

Added by Adrian Föder over 8 years ago. Updated about 8 years ago.

Status:
Resolved
Priority:
Must have
Category:
Cli
Target version:
-
Start date:
2012-12-14
Due date:
% Done:

100%

Estimated time:
PHP Version:
Has patch:
No
Complexity:

Description

when calling flow on Windows (on the native cmd shell), the following occurs:

Flow: Invalid root path. (Error #1248964375)
"/" does not lead to
"C:/Users/afoeder/PhpstormProjects/acme/Distribution/Packages/Framework/TYPO3.Flow/" 


Related issues

Related to TYPO3.Flow - Bug #31642: call a cli script with absolute path doesn't workResolvedBastian Waidelich2011-11-07

Actions
#1

Updated by Hartmann Andreas over 8 years ago

I happened to get that error right after cloning and doing a composer install, too. In my case the problem was solved after browsing to the flow/welcome page and executing the commands shown there in step 1.

Example:

set FLOW_ROOTPATH=D:\xampp\htdocs\vhostrootdir\Base

#2

Updated by Alexander Berl over 8 years ago

I dug deeper into the cause of this problem (this didn't happen in 1.1) and found the following:

In the Packages\Framework\TYPO3.Flow\Scripts\flow.php file the server variable FLOW_ROOTPATH is set to the dir of the current script unless the FLOW_ROOTPATH environment variable is set:

$_SERVER['FLOW_ROOTPATH'] = trim(getenv('FLOW_ROOTPATH'), '"\' ') ?: dirname($_SERVER['PHP_SELF']);

and since in the bootstrap defineConstants "x/Packages/Framework/TYPO3.Flow/Scripts" (the path of the script) is different from the expected path "x" the exception is thrown.

Solutions:
Change the flow.php line back to pre 2.0 way (not sure of the implications as I don't know why it was changed), ie:

$_SERVER['FLOW_ROOTPATH'] = trim(getenv('FLOW_ROOTPATH'), '"\' ') ?: '';

OR

use the same default as is expected in bootstrap (You must start TYPO3 Flow from the root directory or set the environment variable FLOW_ROOTPATH correctly.), i.e. the cwd:

$_SERVER['FLOW_ROOTPATH'] = trim(getenv('FLOW_ROOTPATH'), '"\' ') ?: getcwd();
#3

Updated by Adrian Föder over 8 years ago

  • Status changed from New to Needs Feedback
  • Assignee changed from Adrian Föder to Bastian Waidelich

very good catch Alex, obviously this was introduced exactly with Ibd70e2dc8ff3a958a33ad0eb422060dc0fd8b799 (https://review.typo3.org/#/c/17069/) but has the side effect we encounter here.
Bastian, any ideas for improvements? (I assigned you so far in order to get you notified)

#4

Updated by Adrian Föder over 8 years ago

ahhh too bad; the problematic variable is, as already mentioned, the dirname($_SERVER['PHP_SELF']).

I realized that, with "shell use" (i.e. ./flow), $_SERVER['PHP_SELF'] equals "./flow" because the shell file includes the Scripts/flow.php file.
However, the windows use, flow.bat, just calls the Scripts/flow.php file directly, hence $_SERVER['PHP_SELF'] in that case equals "Packages/Framework/TYPO3.Flow/Scripts/flow.php".

Would there be a way to set some (env variable) in the batch file?

#5

Updated by Adrian Föder over 8 years ago

  • Status changed from Needs Feedback to Under Review
#6

Updated by Gerrit Code Review over 8 years ago

Patch set 4 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/17595

#7

Updated by Simon Schaufelberger over 8 years ago

looks like people don't test changes properly in windows as well since it had worked as Alexander wrote before.

#8

Updated by Adrian Föder over 8 years ago

Simon, even I, working exclusively via Windows with Flow, didn't realize this stopper for a couple of time; so I would say it actually is tested properly and constantly on Windows; but this exactly well has just been a bad bug ;)

#9

Updated by Gerrit Code Review over 8 years ago

Patch set 5 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/17595

#10

Updated by Gerrit Code Review over 8 years ago

Patch set 6 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/17595

#11

Updated by Gerrit Code Review over 8 years ago

Patch set 7 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/17595

#12

Updated by Adrian Föder over 8 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
#13

Updated by Gerrit Code Review over 8 years ago

  • Status changed from Resolved to Under Review

Patch set 1 for branch 2.0 has been pushed to the review server.
It is available at https://review.typo3.org/19083

#14

Updated by Gerrit Code Review about 8 years ago

Patch set 1 for branch composer has been pushed to the review server.
It is available at https://review.typo3.org/19350

#15

Updated by Adrian Föder about 8 years ago

  • Status changed from Under Review to Resolved

Also available in: Atom PDF