Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sspak crashes with autoloader errors #76

Open
tractorcow opened this issue Jul 16, 2020 · 2 comments
Open

sspak crashes with autoloader errors #76

tractorcow opened this issue Jul 16, 2020 · 2 comments

Comments

@tractorcow
Copy link

When doing the below command

sspak save . myfile.sspak

sspak will crash if you are using any injected dependencies which require the class manifest to load.

This is because sspak will invoke autoload.php, but it will NOT call CoreKernel::bootManifests.

In my case it errors when loading monolog, due to this class not loading.

https://github.com/phptek/silverstripe-sentry/blob/master/_config/config.yml

#!/usr/bin/env php
PHP Fatal error:  Uncaught SilverStripe\Core\Injector\InjectorNotFoundException: ReflectionException: Class PhpTek\Sentry\Handler\SentryMonologHandler does not exist in /Users/damian.mooyman/Sites/tvnz-sales/vendor/silverstripe/framework/src/Core/Injector/InjectionCreator.php:17
Stack trace:
#0 /Users/damian.mooyman/Sites/tvnz-sales/vendor/silverstripe/framework/src/Core/Injector/InjectionCreator.php(17): ReflectionClass->__construct('PhpTek\\Sentry\\H...')
#1 /Users/damian.mooyman/Sites/tvnz-sales/vendor/silverstripe/framework/src/Core/Injector/Injector.php(595): SilverStripe\Core\Injector\InjectionCreator->create('PhpTek\\Sentry\\H...', Array)
#2 /Users/damian.mooyman/Sites/tvnz-sales/vendor/silverstripe/framework/src/Core/Injector/Injector.php(1003): SilverStripe\Core\Injector\Injector->instantiate(Array, 'PhpTek\\Sentry\\H...', 'singleton')
#3 /Users/damian.mooyman/Sites/tvnz-sales/vendor/silverstripe/framework/src/Core/Injector/Injector.php(956): SilverStripe\Core\Injector\Injector->getNamedService('PhpTek\\Sentry\\H...', in /Users/damian.mooyman/Sites/tvnz-sales/vendor/silverstripe/framework/src/Core/Injector/InjectionCreator.php on line 19
Command: /usr/bin/env 'php' '/tmp/sspak-sniffer-341859.php' '.'
Execution failed: returned 255.
Output:

Fatal error: Uncaught SilverStripe\Core\Injector\InjectorNotFoundException: ReflectionException: Class PhpTek\Sentry\Handler\SentryMonologHandler does not exist in /Users/damian.mooyman/Sites/tvnz-sales/vendor/silverstripe/framework/src/Core/Injector/InjectionCreator.php:17
Stack trace:
#0 /Users/damian.mooyman/Sites/tvnz-sales/vendor/silverstripe/framework/src/Core/Injector/InjectionCreator.php(17): ReflectionClass->__construct('PhpTek\\Sentry\\H...')
#1 /Users/damian.mooyman/Sites/tvnz-sales/vendor/silverstripe/framework/src/Core/Injector/Injector.php(595): SilverStripe\Core\Injector\InjectionCreator->create('PhpTek\\Sentry\\H...', Array)
#2 /Users/damian.mooyman/Sites/tvnz-sales/vendor/silverstripe/framework/src/Core/Injector/Injector.php(1003): SilverStripe\Core\Injector\Injector->instantiate(Array, 'PhpTek\\Sentry\\H...', 'singleton')
#3 /Users/damian.mooyman/Sites/tvnz-sales/vendor/silverstripe/framework/src/Core/Injector/Injector.php(956): SilverStripe\Core\Injector\Injector->getNamedService('PhpTek\\Sentry\\H...', in /Users/damian.mooyman/Sites/tvnz-sales/vendor/silverstripe/framework/src/Core/Injector/InjectionCreator.php on line 19

@tractorcow
Copy link
Author

I can get around this for the time being by manually adding psr-4 loading to my project root.

"autoload": {
        "psr-4": {
            "App\\": "app/src/",
            "PhpTek\\Sentry\\": "vendor/phptek/sentry/src/",
            "PhpTek\\Sentry\\Monolog\\": "vendor/phptek/sentry/src/"
        },
        "classmap": [
            "app/src/Page.php",
            "app/src/PageController.php"
        ]
    }

@tractorcow
Copy link
Author

By the way, if you encounter this issue, sometimes you can "flush" it by running vendor/bin/sake dev/build flush=all

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants