Skip to content

Commit ac34190

Browse files
committed
Fix requiring the autoloader
1 parent d7f1d99 commit ac34190

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

agent/src/sentry-agent.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,18 @@
99
use Sentry\Agent\EnvelopeQueue;
1010
use Sentry\Agent\Server;
1111

12+
$vendorPath = __DIR__ . '/../vendor';
13+
1214
if (class_exists('Phar') && Phar::running(false) !== '') {
1315
// If running the .phar directly from ./vendor/bin/, we don't want to use $_composer_autoload_path since this
1416
// will load the projects files and lead to ClassNotFound errors.
1517
// We want to use the autoload.php from the phar itself.
16-
$vendorPath = __DIR__ . '/../vendor';
18+
require_once "{$vendorPath}/autoload.php";
1719
} else {
1820
// This works fine for local development or if running the phar from ./vendor/sentry/sentry-agent/bin/
19-
$vendorPath = $_composer_autoload_path ?? __DIR__ . '/../vendor';
21+
require_once $_composer_autoload_path ?? "{$vendorPath}/autoload.php";
2022
}
2123

22-
require_once "{$vendorPath}/autoload.php";
23-
2424
$sentryAgentVersion = '0.0.0';
2525

2626
if (file_exists("{$vendorPath}/composer/installed.php")) {

0 commit comments

Comments
 (0)