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 !
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | 3126782-9-remove-conditional-for-8-7.patch | 2.02 KB | tr |
| #6 | filesystem-urischeme.patch | 1.15 KB | tr |
| #3 | 3126782-3.patch | 1.38 KB | tr |
Comments
Comment #2
tr commentedComment #3
tr commentedHere's the patch.
Comment #5
tr commentedCommitted #3, but leaving this issue open so that we remember to remove this hack when D8.7 becomes unsupported.
Comment #6
tr commentedD9 testing revealed that there is one usage of
FileSystem::uriScheme()that needs to be fixed in the same way as above.Comment #8
tr commentedCommitted #6. The tests in that comment show that this module now works with Drupal 9.
Comment #9
tr commentedHere'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.
Comment #11
tr commentedAs 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+
Comment #12
rivimeyComment #14
tr commentedDrupal 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+.
Comment #16
pianomansam commentedRelease 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?
Comment #17
klemendev commentedGood catch. I agree this should be fixed before marking it D9 compatible.
Comment #18
tr commented@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.
Comment #19
pianomansam commented@TR thanks for the clarficiation. I was running the Upgrade Status module and it was complaining about the use of file_uri_schema().
Comment #20
rivimeyI believe that this exact problem is a known caveat with upgrade_status: it is after all a static analysis tool, not a dynamic one.