mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
FIX BASE_PATH fallback assumed wrong file location (#9977)
The file was moved back in 2017 with 3873e4ba00 (diff-8ce3f007bef0668c2c08320160362229abce9614025dc2a5b729d1b2b56ed3f7)
,
but the logic wasn't updated. That wasn't apparent since the fallback usually doesn't need to be triggered.
Whenever constants.php is included through the standard composer autoload, the debug_backtrace() logic took priority.
This is an important piece for using CoreKernel directly to boot Silverstripe,
which I'm currently attempting through a composer plugin (so a different autoloading path).
https://github.com/silverstripe/silverstripe-graphql-composer-plugin
This commit is contained in:
parent
2e5908cf21
commit
b2a85e7a02
@ -58,9 +58,10 @@ if (!defined('BASE_PATH')) {
|
||||
}
|
||||
}
|
||||
|
||||
// Determine BASE_PATH by assuming that this file is framework/src/Core/Constants.php
|
||||
// we can then determine the base path
|
||||
$candidateBasePath = rtrim(dirname(dirname(dirname(__DIR__))), DIRECTORY_SEPARATOR);
|
||||
// Determine BASE_PATH by assuming that this file is vendor/silverstripe/framework/src/includes/constants.php
|
||||
// we can then determine the base path
|
||||
$candidateBasePath = rtrim(dirname(__DIR__, 5), DIRECTORY_SEPARATOR);
|
||||
|
||||
// We can't have an empty BASE_PATH. Making it / means that double-slashes occur in places but that's benign.
|
||||
// This likely only happens on chrooted environemnts
|
||||
return $candidateBasePath ?: DIRECTORY_SEPARATOR;
|
||||
|
Loading…
Reference in New Issue
Block a user