diff --git a/agent/box.json b/agent/box.json index 97c64bb..f230486 100644 --- a/agent/box.json +++ b/agent/box.json @@ -1,6 +1,6 @@ { "main": "src/sentry-agent.php", "output": "../bin/sentry-agent", - "alias": "sentry-agent.phar", + "alias": "sentry-agent", "timestamp": "20250904" } diff --git a/agent/src/sentry-agent.php b/agent/src/sentry-agent.php index 970c58b..1f28b7e 100755 --- a/agent/src/sentry-agent.php +++ b/agent/src/sentry-agent.php @@ -15,7 +15,15 @@ exit; } -require $_composer_autoload_path ?? __DIR__ . '/../vendor/autoload.php'; +if (class_exists('Phar') && Phar::running(false) !== '') { + // If running the .phar directly from ./vendor/bin/, we don't want to use $_composer_autoload_path since this + // will load the projects files and lead to ClassNotFound errors. + // We want to use the autoload.php from the phar itself. + require __DIR__ . '/../vendor/autoload.php'; +} else { + // This works fine for local development or if running the phar from ./vendor/sentry/sentry-agent/bin/ + require $_composer_autoload_path ?? __DIR__ . '/../vendor/autoload.php'; +} // @TODO: "sentryagent" with a 5 in front, it's a unused "user port": https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml?search=5148 // Maybe there is a better way to select a port to use but for now this is fine. diff --git a/bin/sentry-agent b/bin/sentry-agent index 7d73307..c69856f 100755 Binary files a/bin/sentry-agent and b/bin/sentry-agent differ diff --git a/bin/sentry-agent.sig b/bin/sentry-agent.sig index 7dfdcf2..5f6bc4c 100644 --- a/bin/sentry-agent.sig +++ b/bin/sentry-agent.sig @@ -1 +1 @@ -52CA959C330A3E693A9977E17A16D8244AE7ECE1D807F8470D26FBB370A34F71E04731127DDBBC0EB5C73091023B20EB4A73754170322FF81EB037898AF5F667 +08702101B575BBFB940A721633C715043D2230509868C02E738B28971A3700182F914BDA9A8AC9AC43BB3944E64DDEE50BD13499FB97082966B860BDBFCA9F18