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

Errors when loading extension files should not halt the inspection #3

Closed
mglaman opened this issue Dec 19, 2018 · 0 comments
Closed

Comments

@mglaman
Copy link
Owner

mglaman commented Dec 19, 2018

An example is the Mandrill module.

// Load Mandrill library if found in module's /lib directory.
if (file_exists(drupal_get_path('module', 'mandrill') . '/lib/mandrill/src/Mandrill.php')) {
  require drupal_get_path('module', 'mandrill') . '/lib/mandrill/src/Mandrill.php';
}

This is due to drupal_get_path which calls drupal_get_filename and taps into the service container.

It is fixed with

                try {
                    require $module_dir . '/' . $module->getExtensionFilename();
                } catch (\Throwable $e) {
                    // Something prevent the extension file from loading.
                }
ptt-homme added a commit to ptt-homme/phpstan-drupal that referenced this issue Dec 28, 2021
ptt-homme added a commit to ptt-homme/phpstan-drupal that referenced this issue Dec 28, 2021
ptt-homme added a commit to ptt-homme/phpstan-drupal that referenced this issue Dec 28, 2021
ptt-homme added a commit to ptt-homme/phpstan-drupal that referenced this issue Dec 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant