Skip to content

Commit

Permalink
[BUGFIX] Use correct autoload path, in case this package is linked
Browse files Browse the repository at this point in the history
In current Composer versions, the binaries are not links any more
but files to allow the packages to be linked (e.g. from path repository).
For that Composer populates $GLOBALS['_composer_autoload_path']
in the created binary file to expose the correct path to the autoload
file for this installation.

So we should use this path if a current Composer version is used
and can gracefully fall back to directory traversal for older versions.
  • Loading branch information
helhum committed Aug 14, 2023
1 parent 1572143 commit 2fb4106
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion typo3
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* that executes commands
*/
call_user_func(function() {
$classLoader = require __DIR__ . '/../../autoload.php';
$classLoader = require ($GLOBALS['_composer_autoload_path'] ?? __DIR__ . '/../../autoload.php');
\TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::run(1, \TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::REQUESTTYPE_CLI);
\TYPO3\CMS\Core\Core\Bootstrap::init($classLoader, true)->get(\TYPO3\CMS\Core\Console\CommandApplication::class)->run();
});

0 comments on commit 2fb4106

Please sign in to comment.