Closes #3458177
Closes #3458177
Merge request reports
Activity
122 122 protected function parseClass(string $class, \SplFileInfo $fileinfo): array { 123 123 // @todo Consider performance improvements over using reflection. 124 124 // @see https://www.drupal.org/project/drupal/issues/3395260. 125 $reflection_class = new \ReflectionClass($class); 125 try { 126 $reflection_class = new \ReflectionClass($class); 127 } 128 catch (\Throwable $t) { 129 // If reflection failed on the class, it could be due to the class 130 // implementing or extending from interfaces/classes that are not 131 // available to the classloader. This can happen in contrib when a class 132 // in a module extends from a class in another module that is not 133 // installed. In that case, just skip the plugin. 134 return ['id' => NULL, 'content' => NULL]; Returning this array doesn't necessary work, because this result gets saved in the APCU file cache by the calling
getDefinitions()
method.So assuming a module is not installed, and discovery for this plugin leads to an empty result, when the module is installed, discovery won't pick up the plugin because no changes have been made to the file. This situation isn't detectable by anything other than browser tests, because in other tests, all module classes are discoverable.
We've been working on some similar solutions in https://www.drupal.org/project/drupal/issues/3421014 because migrate source plugins specifically need this, but it's kinda stalled.
The discovery cache yes. But when discovery looks for plugins again, the file cache that holds the plugin data is not cleared unless the modified time of the class file has changed.
In the migrate source conversion, there were browser tests that were failing for this very reason.
Edited by godotislate
added 44 commits
-
5198323e...01b55ef5 - 42 commits from branch
project:11.x
- 84f0b214 - Merge branch '11.x' into 3458177-changing-plugins-from
- 31db6459 - remove filecache
-
5198323e...01b55ef5 - 42 commits from branch
added 4 commits
-
f218e738...bf4dfeaa - 2 commits from branch
project:11.x
- fce08fc7 - Merge branch '11.x' into 3458177-changing-plugins-from
- db7f2017 - CR and deprecations
-
f218e738...bf4dfeaa - 2 commits from branch
added 1 commit
- 17946da2 - fix SlevomatCodingStandard.Exceptions.RequireNonCapturingCatch.NonCapturingCatchRequired
added 44 commits
-
17946da2...24b7c3ff - 36 commits from branch
project:11.x
- 214f1de3 - Update file AttributeClassDiscovery.php
- d8887e7a - Add tests
- a15388b2 - fix
- e0970b8b - remove filecache
- 235f786a - fix
- 234ba5ad - adjust tests
- 8c8eddbd - CR and deprecations
- a7c8be65 - fix SlevomatCodingStandard.Exceptions.RequireNonCapturingCatch.NonCapturingCatchRequired
Toggle commit list-
17946da2...24b7c3ff - 36 commits from branch