file_uri_scheme() is deprecated in drupal:8.8.0 and is removed from drupal:9.0.0.
Use Drupal\Core\StreamWrapper\StreamWrapperManagerInterface::getScheme() instead.

This change is needed for D9 compatibility, but since core did not backport this change to Drupal 8.7 we CAN'T fix this until Drupal 8.7 becomes unsupported, which is the same time as Drupal 9.0 is released.

But as this is the only remaining deprecation, and in order to test this module with D9, here is a patch which does something very ugly - it adds a conditional to check the version of Drupal we're using and do something different if we're using D8.8 or greater. This should allow the module to run on D8.7, D8.8, and D9.0, but should be removed IMMEDIATELY upon the release of D9.0 !

Comments

TR created an issue. See original summary.

tr’s picture

Issue summary: View changes
tr’s picture

Status: Active » Needs review
StatusFileSize
new1.38 KB

Here's the patch.

  • TR committed adbf139 on 8.x-1.x
    Issue #3126782 by TR: Conditionally replace  file_uri_scheme() until...
tr’s picture

Status: Needs review » Postponed

Committed #3, but leaving this issue open so that we remember to remove this hack when D8.7 becomes unsupported.

tr’s picture

StatusFileSize
new1.15 KB

D9 testing revealed that there is one usage of FileSystem::uriScheme() that needs to be fixed in the same way as above.

  • TR committed eb65e93 on 8.x-1.x
    Issue #3126782 by TR: Conditionally replace FileSystem::uriScheme()...
tr’s picture

Committed #6. The tests in that comment show that this module now works with Drupal 9.

tr’s picture

Status: Postponed » Needs review
StatusFileSize
new2.02 KB

Here's a patch to remove the conditional needed for D8.7 support. This will be committed *after* the new alpha release is made this week because it breaks support for 8.7.

Status: Needs review » Needs work

The last submitted patch, 9: 3126782-9-remove-conditional-for-8-7.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

tr’s picture

Status: Needs work » Needs review

As expected, the patch causes test fails in D8.7 which is why this needs to be delayed until after our last D8.7-compatible release is made.

But also as expected, the tests pass in D8.8+

rivimey’s picture

Status: Needs review » Reviewed & tested by the community

  • TR committed d032f89 on 8.x-1.x
    Issue #3126782 by TR: Replace  file_uri_scheme() when Drupal 8.8 becomes...
tr’s picture

Status: Reviewed & tested by the community » Fixed

Drupal core dropped support for D8.7 two days ago.

mimemail 8.x-1.0-alpha3 was released today, which is the last release that will be compatible with D8.7.

See also #3147165: Declare explicit dependency on D8.8+ / Drop support for D8.7

We can now commit this and focus on D8.8+.

Status: Fixed » Closed (fixed)

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

pianomansam’s picture

Release 8.x-1.0-alpha3 claims to be compatible for Drupal 9 but it is not because of its use of file_uri_scheme(). Can we get a new, full release that removes the use of file_uri_scheme?

klemendev’s picture

Good catch. I agree this should be fixed before marking it D9 compatible.

tr’s picture

@pianomansam: No, that's not correct. The alpha3 release IS compatible with Drupal 9. It checks for what version of Drupal you're using and then calls file_uri_schema() ONLY IF YOU'RE USING DRUPAL <8.8. That is how we maintained compatibility with both D8.7 and D9.0 at the same time. As you can see above and in the automated tests tab on the project page, the D9.0 tests PASSED in the alpha3 release.

Perhaps (?) a static analysis complains about file_uri_schema() in D9, but that would be a false positive - file_uri_schema() cannot be called and will not be called in D9 because of the conditional statement. The alpha3 code works fine in D9 and does not crash or cause any problems.

I have been running Mime Mail on a D9 site without a problem since the middle of April, that's almost four months now.

pianomansam’s picture

@TR thanks for the clarficiation. I was running the Upgrade Status module and it was complaining about the use of file_uri_schema().

rivimey’s picture

I believe that this exact problem is a known caveat with upgrade_status: it is after all a static analysis tool, not a dynamic one.