mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
FIX: Don’t double-include composer autoloader
If another file is include main.php and has included composer already, code might get weird. In particular, if the parent context includes a different vendor/autoload.php than the one main.php expects.
This commit is contained in:
parent
93a0122c0f
commit
6b640f81f2
22
main.php
22
main.php
@ -57,17 +57,19 @@ if (version_compare(phpversion(), '5.5.0', '<')) {
|
|||||||
* @see Director::direct()
|
* @see Director::direct()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// require composers autoloader
|
// require composers autoloader, unless it is already installed
|
||||||
if (file_exists($autoloadPath = dirname(__DIR__) . '/vendor/autoload.php')) {
|
if(!class_exists('Composer\\Autoload\\ClassLoader', false)) {
|
||||||
require_once $autoloadPath;
|
if (file_exists($autoloadPath = dirname(__DIR__) . '/vendor/autoload.php')) {
|
||||||
}
|
require_once $autoloadPath;
|
||||||
else {
|
}
|
||||||
if (!headers_sent()) {
|
else {
|
||||||
header($_SERVER['SERVER_PROTOCOL'] . " 500 Server Error");
|
if (!headers_sent()) {
|
||||||
header('Content-Type: text/plain');
|
header($_SERVER['SERVER_PROTOCOL'] . " 500 Server Error");
|
||||||
|
header('Content-Type: text/plain');
|
||||||
|
}
|
||||||
|
echo "Failed to include composer's autoloader, unable to continue\n";
|
||||||
|
exit(1);
|
||||||
}
|
}
|
||||||
echo "Failed to include composer's autoloader, unable to continue\n";
|
|
||||||
exit(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// IIS will sometimes generate this.
|
// IIS will sometimes generate this.
|
||||||
|
Loading…
Reference in New Issue
Block a user