Problem/Motivation
If you install Simple OAuth on Drupal 8.7 and you visit /admin/config/people/simple_oauth, you will get this exception:
PHP Fatal error: Class Drupal\simple_oauth\Service\Filesystem\Filesystem contains 8 abstract methods and must therefore be declared abstract or implement the remaining methods (Drupal\Core\File\FileSystemInterface::copy, Drupal\Core\File\FileSystemInterface::delete, Drupal\Core\File\FileSystemInterface::deleteRecursive, ...) in modules/simple_oauth/src/Service/Filesystem/Filesystem.php on line 10
Methods were added to FileSystemInterface in Drupal 8.7, apparently, so this module is unusable until all the new methods are implemented. :(
Proposed resolution
Implement the missing methods.
Remaining tasks
Patch, review, commit.
| Comment | File | Size | Author |
|---|---|---|---|
| #14 | 3043454--interdiff--11-14.txt | 3.37 KB | e0ipso |
| #14 | 3043454--filesystem-interface-changes--14.patch | 14.21 KB | e0ipso |
| #14 | 3043454--filesystem-interface-changes--14.patch | 14.21 KB | e0ipso |
| #13 | 3043454--filesystem-interface-changes--11.patch | 10.84 KB | e0ipso |
| #6 | 3043454--filesystem-interface-changes--6.patch | 7.86 KB | e0ipso |
Comments
Comment #2
phenaproximaThis fixes it for me. Not sure if this needs tests, but happy to add one if asked.
Comment #3
phenaproximaAdded a unit test. Confirmed locally that removing the new methods reproduces the correct failure.
Comment #4
wim leersLGTM. And AFAICT this will work fine on Drupal 8.5 and 8.6 too: they don't have these methods, but there this can simply be considered "dead code that will come alive in the future".
Comment #5
e0ipsoLet's see if this patch mitigates the risk of breaking this in the future. The current implementation is not ideal, we should break the 2 services… but this is a good step forward.
Comment #6
e0ipsoI'll merge this one if green, it should be more resilient than the existing code and the previous patches in this issue.
Comment #7
wim leersWhy didn't I think of this? 😄
Curious what @Berdir thinks of this :)
Comment #8
berdirThat only works if you stop implementing the interface. And then it IMHO would not be possible to inject that service into something that type hints on FileSystemInterface?
I think a separate service that does not decorate is nicer here anyway, we only want to do something special on our specific use cases (I actually don't know what that is), it seems strange that a module like simple_oauth intercepts everyone's interaction with the file system service.
Comment #9
wim leers#8: hah, that's why I didn't think of that. Why didn't I think of that? (i.e. Berdir's response) 😄
Seems like I'm multi-tasking too much and missing important details.
This is most definitely true.
Comment #10
phenaproximaLooks like it needs a reroll?
Comment #11
e0ipsoLet's see if this one applies.
Comment #12
e0ipsoComment #13
e0ipsoThe actual patch 🤦♀️
Comment #14
e0ipsoSome additional fixes.
Comment #16
e0ipsoThanks everyone!
Comment #18
hiddenfellon commentedThis actually needs to be reopened. I applied your patch and now I get this error Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: You have requested a non-existent service "simple_oauth.filesystem_checker". Did you mean this: "simple_oauth.filesystem"? in Drupal\Component\DependencyInjection\Container-
>get() (line 153 of /public_html/core/lib/Drupal/Component/DependencyInjection/Container.php).
not to mention I still change access the config settings to setup a client.
Comment #19
shahankitb1982 commentedHi @hiddenfellon. Just clear the cache, then it should be fine.