Skip to content

Commit c34e734

Browse files
authored
Prevent MAGE_DIRS overwrite in pub/index.php
1 parent f710f9b commit c34e734

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

pub/index.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,15 @@
2525
}
2626

2727
$params = $_SERVER;
28-
$params[Bootstrap::INIT_PARAM_FILESYSTEM_DIR_PATHS] = [
29-
DirectoryList::PUB => [DirectoryList::URL_PATH => ''],
30-
DirectoryList::MEDIA => [DirectoryList::URL_PATH => 'media'],
31-
DirectoryList::STATIC_VIEW => [DirectoryList::URL_PATH => 'static'],
32-
DirectoryList::UPLOAD => [DirectoryList::URL_PATH => 'media/upload'],
33-
];
28+
$params[Bootstrap::INIT_PARAM_FILESYSTEM_DIR_PATHS] = array_replace_recursive(
29+
$params[Bootstrap::INIT_PARAM_FILESYSTEM_DIR_PATHS],
30+
[
31+
DirectoryList::PUB => [DirectoryList::URL_PATH => ''],
32+
DirectoryList::MEDIA => [DirectoryList::URL_PATH => 'media'],
33+
DirectoryList::STATIC_VIEW => [DirectoryList::URL_PATH => 'static'],
34+
DirectoryList::UPLOAD => [DirectoryList::URL_PATH => 'media/upload'],
35+
]
36+
);
3437
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $params);
3538
/** @var \Magento\Framework\App\Http $app */
3639
$app = $bootstrap->createApplication(\Magento\Framework\App\Http::class);

0 commit comments

Comments
 (0)