Bug #7847

Missing trailing slash in FLOW3_ROOTPATH causes fatal error

Added by Michael Schams about 5 years ago. Updated almost 5 years ago.

Status:Resolved Start date:2010-05-28
Priority:Could have Due date:
Assigned To:Karsten Dambekalns % Done:

100%

Category:Core
Target version:TYPO3 Flow Base Distribution - 1.0 alpha 9 Estimated time:1.00 hour
PHP Version: Complexity:
Has patch: Affected Flow version:

Description

Trailing slash "/" at environment variable FLOW3_ROOTPATH is absolutely required in file .htaccess - a missing trailing slash causes a fatal error and FLOW3 isn't executed.

Correct:
SetEnv FLOW3_ROOTPATH /var/www/myapp/

Causes a fatal error:
SetEnv FLOW3_ROOTPATH /var/www/myapp

The path to FLOW3.php is generated in file "Web/index.php" at run time and a more tolerant behaviour would be desirable.

Fatal error in logfile (caused by missing slash between FLOW3_ROOTPATH and "Packages/...":
[Thu May 20 07:06:29 2010] [error] [client 10.9.8.101] PHP Fatal error: require(): Failed opening required '/var/www/myappPackages/Framework/FLOW3/Scripts/FLOW3.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/myapp/Web/index.php on line 31

Possible solution:
Update "index.php" as follows (or similar)

require(preg_replace('/\/*$/', '', $rootPath) . '/Packages/Framework/FLOW3/Scripts/FLOW3.php');

This regular expression removes trailing slash/slashes (if exist/s) of $rootPath and adds one between $rootPath and "Packages/...". So, path to FLOW3.php is always as expected, regardless of SetEnv FLOW3_ROOTPATH in .htaccess (with/without trailing slash).

History

#1 Updated by Karsten Dambekalns about 5 years ago

  • Category set to Core
  • Status changed from New to Accepted
  • Assigned To set to Karsten Dambekalns
  • Target version set to 1.0 alpha 9
  • Start date changed from 2010-05-20 to 2010-05-28
  • Estimated time set to 1.00

#2 Updated by Karsten Dambekalns about 5 years ago

  • Status changed from Accepted to Resolved
  • % Done changed from 0 to 100

Resolved as of r4338.

Also available in: Atom PDF