Drupal 8.8 moveds some stream/uri functions to the StreamWrapperManager #3035273: Several file uri/scheme functions deprecated and moved to \Drupal\Core\StreamWrapper\StreamWrapperManagerInterface. The attached patch fixes these. This will allow for the tests to run without notices in 8.8.

  1x: FileSystem::uriScheme() is deprecated in drupal:8.8.0. It will be removed from drupal:9.0.0. Use \Drupal\Core\StreamWrapper\StreamWrapperManagerInterface::getScheme() instead. See https://www.drupal.org/node/3035273
    1x in FetchManagerTest::testStyleOriginalPath from Drupal\Tests\stage_file_proxy\Kernel

  1x: file_default_scheme() is deprecated in drupal:8.8.0. It will be removed from drupal:9.0.0. Use \Drupal::config('system.file')->get('default_scheme') instead. See https://www.drupal.org/node/3049030
    1x in FetchManagerTest::testStyleOriginalPath from Drupal\Tests\stage_file_proxy\Kernel

I moved the constructor out of the FetchManagerInterface. It prevents implementing classes to inject extra services (.e.g config factory). This shouldn't break existing FetchManager implementations.

Comments

interX created an issue. See original summary.

interx’s picture

Issue summary: View changes
interx’s picture

StatusFileSize
new4.76 KB

Urgh, missed one. Here's a new patch.

greggles’s picture

Status: Needs review » Reviewed & tested by the community

This makes sense to me so moving to RTBC. Will wait a bit in case anyone else has feedback.

  • greggles committed c52f179 on 8.x-1.x authored by interX
    Issue #3091092 by interX: D8.8 deprecation warnings
    
greggles’s picture

Status: Reviewed & tested by the community » Fixed

Thanks again! This is now committed.

tobiasb’s picture

Status: Fixed » Needs work

StreamWrapperManager::getScheme is new in 8.8. So this changes breaks all sites which do not use 8.8-xyz. Change record https://www.drupal.org/node/3035273.

greggles’s picture

Ah, ok. So what is the right way to be ready for Drupal 9 and still support 8.7?

tobiasb’s picture

Revert the patch. And only replace deprecations when the function/method is deprecated in officially released version so that we can say we require drupal >= XX.XX.

Or we can check if newFunction is defined use newFunction else use deprecatedFunction. Or check the drupal version.

greggles’s picture

Yes, I agree on reverting this patch ASAP, I'm just wondering what the general advice is to module maintainers to fix deprecation warnings and still be compatible with existing versions of Drupal.

  • greggles committed ddd36aa on 8.x-1.x
    Revert "Issue #3091092 by interX: D8.8 deprecation warnings"
    
    This...
greggles’s picture

Title: D8.8 deprecation warnings » D8.8 deprecation warnings (save for 8.7 EOL).
StatusFileSize
new4.74 KB

I've reverted the commit for now. We need to either save this commit for when 8.7 is EOL or find a way to support both at the same time. I'm putting the status as "Needs work" in hopes of something that can work for 8.7, 8.8 and beyond.

greggles’s picture

BTW, I created https://www.drupal.org/project/stage_file_proxy/releases/8.x-1.0-rc4 so people won't be affected by this.

kristen pol’s picture

Issue tags: +Drupal 9 compatibility

Per a Slack discussion with Gábor Hojtsy regarding usage of D9 tags (Drupal 9, Drupal 9 compatibility, Drupal 9 readiness, etc.), "Drupal 9 compatibility" should be used for contributed projects that need updating and "Drupal 9" was the old tag for D8 issues before the D9 branch was ready. Doing tag cleanup here based on that discussion.

berdir’s picture

I would recommend to just update the info.yml file to require 8.8 at this point and then commit it again. token/pathauto/redirect/paragraphs all require 8.8 now in their dev release.

You can still hold out on actually doing a release for a while, which would give you a way to do a security release with 8.7 support if you want to based on the previous release. IMHO that is the only reason to still support 8.7 now.

greggles’s picture

Status: Needs work » Needs review

Setting back to needs review, but it seems possible these were fixed elsewhere.

spokje’s picture

Status: Needs review » Closed (outdated)

Seems to me all of the code in this patch was already applied in the commit of issue #3139001

rob230’s picture

You are probably aware of this, but Stage File Proxy is broken on Drupal 8.7 due to this error:

Error: Call to undefined method Drupal\Core\StreamWrapper\StreamWrapperManager::getScheme() in Drupal\stage_file_proxy\FetchManager->styleOriginalPath() (line 121 of modules/contrib/stage_file_proxy/src/FetchManager.php)

Despite the release notes saying Drupal 8.7 is the minimum, it is not. Anyone on Drupal 8.7 has to use version stage_file_proxy 1.0-rc4.

berdir’s picture

Drupal 8.7 is unsupported, you shouldn't use it with anything :)
as
It's unfortunate that the version constraint is wrong, a new issue could be opened to set that higher as I suggested already above, would a be trivial patch. However, it's not possible to fix the already created release, that can't be changed, composer would keep installing the incompatible 1.1 even after a correctly defined 1.2 is out. But again, 8.7 is outdated, and 8.8 will be as well soon.