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.

Comments

phenaproxima created an issue. See original summary.

phenaproxima’s picture

Status: Active » Needs review
StatusFileSize
new1.74 KB

This fixes it for me. Not sure if this needs tests, but happy to add one if asked.

phenaproxima’s picture

StatusFileSize
new2.58 KB

Added a unit test. Confirmed locally that removing the new methods reproduces the correct failure.

wim leers’s picture

Category: Bug report » Task
Issue tags: +API-First Initiative

LGTM. 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".

e0ipso’s picture

Let'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.

e0ipso’s picture

I'll merge this one if green, it should be more resilient than the existing code and the previous patches in this issue.

wim leers’s picture

+++ b/src/Service/Filesystem/Filesystem.php
@@ -66,80 +66,20 @@ class Filesystem implements FilesystemInterface {
+  public function __call($name, $arguments) {

Why didn't I think of this? 😄

Curious what @Berdir thinks of this :)

berdir’s picture

That 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.

wim leers’s picture

#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.

it seems strange that a module like simple_oauth intercepts everyone's interaction with the file system service.

This is most definitely true.

phenaproxima’s picture

Status: Needs review » Needs work
Issue tags: +Needs reroll

Looks like it needs a reroll?

e0ipso’s picture

Let's see if this one applies.

e0ipso’s picture

Status: Needs work » Needs review
e0ipso’s picture

The actual patch 🤦‍♀️

e0ipso’s picture

  • e0ipso committed c1bf3d7 on 8.x-3.x
    Issue #3043454 by e0ipso, phenaproxima, Wim Leers, Berdir: Fatal error...
e0ipso’s picture

Status: Needs review » Fixed

Thanks everyone!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

hiddenfellon’s picture

This 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.

shahankitb1982’s picture

Hi @hiddenfellon. Just clear the cache, then it should be fine.