Bug #7847

Missing trailing slash in FLOW3_ROOTPATH causes fatal error

Added by Michael Schams about 11 years ago. Updated over 10 years ago.

Status:
Resolved
Priority:
Could have
Category:
Core
Start date:
2010-05-28
Due date:
% Done:

100%

Estimated time:
1.00 h
PHP Version:
Has patch:
Complexity:

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).

#1

Updated by Karsten Dambekalns about 11 years ago

  • Category set to Core
  • Status changed from New to Accepted
  • Assignee 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 h
#2

Updated by Karsten Dambekalns about 11 years ago

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

Resolved as of r4338.

Also available in: Atom PDF