Bug #31642
call a cli script with absolute path doesn't work
Status: | Resolved | Start date: | 2011-11-07 | |
---|---|---|---|---|
Priority: | Should have | Due date: | ||
Assigned To: | Bastian Waidelich | % Done: | 100% |
|
Category: | Cli | |||
Target version: | TYPO3 Flow Base Distribution - 2.0 beta 1 | |||
PHP Version: | Complexity: | |||
Has patch: | No | Affected Flow version: | FLOW3 1.0.0 |
Description
[foobar ~]$ /var/www/htdocs/flow3
string(59) "/var/www/htdocs/Packages/Framework/TYPO3.FLOW3/Classes/Core"
string(0) ""
FLOW3: Invalid root path. (Error #1248964375)
"/" does not lead to
"/var/www/htdocs/Packages/Framework/TYPO3.FLOW3/"
If the script is called from the directory /var/www/htdocs
[foobar /var/www/htdocs]$ ./flow3
FLOW3 1.0.0 ("Development" context)
usage: ./flow3 <command identifier>
See './flow3 help' for a list of all available commands.
Related issues
Associated revisions
[BUGFIX] Invoking CLI from a different directory doesn't work
When executing the TYPO3 Flow CLI from a directory that is
not equal to the root path and if the FLOW_ROOTPATH environment
variable is not set, Flow dies with an exception.
This change fixes this by falling back to the current directory in that
case.
Change-Id: Ibd70e2dc8ff3a958a33ad0eb422060dc0fd8b799
Fixes: #31642
Releases: 1.1, 1.2
[BUGFIX] Invoking CLI from a different directory doesn't work
When executing the FLOW3 CLI from a directory that is not equal to the
root path and if the FLOW3_ROOTPATH environment variable is not set,
FLOW3 dies with an exception.
This change fixes this by falling back to the current directory in that
case.
Change-Id: Ibd70e2dc8ff3a958a33ad0eb422060dc0fd8b799
Fixes: #31642
Releases: 1.1, 1.2
[BUGFIX] Flow CLI again works for Windows command prompt
Probably introduced with Ibd70e2dc8ff3a958a33ad0eb422060dc0fd8b799,
the Flow CLI call via the provided .bat file didn't work anymore
because the used ``$_SERVER['PHP_SELF']`` will behave differently
for the flow shell and the flow.bat file: in case of the shell,
the actual ``Scripts/flow.php`` file will be included, while in
case of the .bat file, the ``Scripts/flow.php`` file is immediately
called with PHP. This results in a different PHP_SELF value.
The ``FLOW_ROOTPATH`` value which has to be determined, now is built
manually in case of a ``DIRECTORY_SEPARATOR`` equaling a
Windows one.
Additionally, in order to still allow calling the flow executable
from arbitrary locations also for Windows, the flow.bat file
is adjusted a bit in order to not rely on being at the root
path when calling the file.
Change-Id: Icc55e90ba4aff11efab1e2b8307fdbbe41b35735
Fixes: #44000
Related: #31642
Releases: master, 2.0
[BUGFIX] Flow CLI again works for Windows command prompt
Probably introduced with Ibd70e2dc8ff3a958a33ad0eb422060dc0fd8b799,
the Flow CLI call via the provided .bat file didn't work anymore
because the used ``$_SERVER['PHP_SELF']`` will behave differently
for the flow shell and the flow.bat file: in case of the shell,
the actual ``Scripts/flow.php`` file will be included, while in
case of the .bat file, the ``Scripts/flow.php`` file is immediately
called with PHP. This results in a different PHP_SELF value.
The ``FLOW_ROOTPATH`` value which has to be determined, now is built
manually in case of a ``DIRECTORY_SEPARATOR`` equaling a
Windows one.
Additionally, in order to still allow calling the flow executable
from arbitrary locations also for Windows, the flow.bat file
is adjusted a bit in order to not rely on being at the root
path when calling the file.
Change-Id: Icc55e90ba4aff11efab1e2b8307fdbbe41b35735
Fixes: #44000
Related: #31642
Releases: master, 2.0
[BUGFIX] Flow CLI again works for Windows command prompt
Probably introduced with Ibd70e2dc8ff3a958a33ad0eb422060dc0fd8b799,
the Flow CLI call via the provided .bat file didn't work anymore
because the used ``$_SERVER['PHP_SELF']`` will behave differently
for the flow shell and the flow.bat file: in case of the shell,
the actual ``Scripts/flow.php`` file will be included, while in
case of the .bat file, the ``Scripts/flow.php`` file is immediately
called with PHP. This results in a different PHP_SELF value.
The ``FLOW_ROOTPATH`` value which has to be determined, now is built
manually in case of a ``DIRECTORY_SEPARATOR`` equaling a
Windows one.
Additionally, in order to still allow calling the flow executable
from arbitrary locations also for Windows, the flow.bat file
is adjusted a bit in order to not rely on being at the root
path when calling the file.
Change-Id: Icc55e90ba4aff11efab1e2b8307fdbbe41b35735
Fixes: #44000
Related: #31642
Releases: master, 2.0
History
#1 Updated by Helmut Hummel over 3 years ago
Can anybody with the permissions, mov this to the FLOW3 project?
#2 Updated by Dietrich Heise over 3 years ago
- Project changed from Base Distribution to TYPO3 Flow Base Distribution
#3 Updated by Helmut Hummel over 3 years ago
This works:
FLOW3_ROOTPATH='/var/www/FLOW3-1.0.0/' export FLOW3_ROOTPATH /var/www/FLOW3-1.0.0/flow3 help
Is this documented somewhere?
#4 Updated by Bastian Waidelich over 3 years ago
- Project changed from TYPO3 Flow Base Distribution to TYPO3.Flow
#5 Updated by Helmut Hummel over 3 years ago
- File flow3-abspath.diff
added
One problem is, that in TYPO3.FLOW3/Scripts/flow3.php
$_SERVER['FLOW3_ROOTPATH'] = trim(getenv('FLOW3_ROOTPATH'), '"\' ') ?: '';
$_SERVER['FLOW3_ROOTPATH'] is set to an empty string whereas in
TYPO3.FLOW3/Classes/Core/Bootstrap.php
$rootPath = isset($_SERVER['FLOW3_ROOTPATH']) ? $_SERVER['FLOW3_ROOTPATH'] : FALSE;
The other problem of course is that setting the environment variable is necessary.
Attached a possible solution.
#6 Updated by Karsten Dambekalns about 3 years ago
- Status changed from New to Accepted
- Assigned To set to Karsten Dambekalns
- Has patch set to No
- Affected Flow version set to FLOW3 1.0.0
#7 Updated by Karsten Dambekalns about 3 years ago
- Category set to Cli
#8 Updated by Bastian Waidelich over 2 years ago
- Assigned To changed from Karsten Dambekalns to Bastian Waidelich
- Target version set to 2.0 beta 1
FYI I stumbled upon this issue the other day and Helmuts patch solves it for me.
@Karsten I'll take over, hope you don't mind – Robert said you wouldn't ;)
#9 Updated by Gerrit Code Review over 2 years ago
- Status changed from Accepted to Under Review
Patch set 1 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/17069
#10 Updated by Karsten Dambekalns over 2 years ago
Bastian Waidelich wrote:
@Karsten I'll take over, hope you don't mind
Not at all!
#11 Updated by Gerrit Code Review over 2 years ago
Patch set 2 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/17069
#12 Updated by Gerrit Code Review over 2 years ago
Patch set 3 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/17069
#13 Updated by Karsten Dambekalns over 2 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
#14 Updated by Gerrit Code Review over 2 years ago
- Status changed from Resolved to Under Review
Patch set 1 for branch FLOW3-1.1 has been pushed to the review server.
It is available at https://review.typo3.org/17120
#15 Updated by Karsten Dambekalns over 2 years ago
- Status changed from Under Review to Resolved