Problem/Motivation

There are a couple of deprecated calls, example uriScheme() and getTarget() function calls in the following modules/hooks:

  • social_event_enrolments / social_event_enrolments_export_file_download()
  • social_group_members / social_group_members_export_file_download()
  • social_user_export / social_user_export_file_download()

Some other deprecated calls on:

  • social_core.install:572 / theme_handler service
  • SocialGroupSecretSubscriber.php:60 / setException()

Steps to reproduce

Download any file from Open Social, or upload a picture, the thumbnail will be broken.

Proposed resolution

Change the deprecated calls from:

  $scheme = \Drupal::service('file_system')->uriScheme($uri);
  $target = \Drupal::service('stream_wrapper_manager')->getTarget($uri);

to

  $scheme = StreamWrapperManager::getScheme($uri);
  $target = StreamWrapperManager::getTarget($uri);

Recommendation:

https://git.drupalcode.org/project/drupal/-/blob/8.9.x/core/lib/Drupal/C...
https://git.drupalcode.org/project/drupal/-/blob/8.9.x/core/lib/Drupal/C...
setException @deprecated since Symfony 4.4, use setThrowable instead

Remaining tasks

N/A

User interface changes

N/A

API changes

N/A

Data model changes

N/A

Issue fork social-3254530

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

tbsiqueira created an issue. See original summary.

tbsiqueira’s picture

Issue summary: View changes
beatrizrodrigues’s picture

Assigned: Unassigned » beatrizrodrigues

I'll work on that.

beatrizrodrigues’s picture

Assigned: beatrizrodrigues » Unassigned
Status: Active » Needs review

I applied the proposed resolution. Please, review :)

tbsiqueira’s picture

Title: Deprecated use of uriScheme() and getTarget » Deprecated use of uriScheme() and getTarget and some other functions
Issue summary: View changes
tbsiqueira’s picture

andregp’s picture

@tbsiqueira, I could not find any documentation on theme_handler service or RequestEvent::setException() being deprecated. Do you have any link?

beatrizrodrigues’s picture

Assigned: Unassigned » beatrizrodrigues
Status: Needs review » Needs work
beatrizrodrigues’s picture

Assigned: beatrizrodrigues » Unassigned
Status: Needs work » Needs review

Please, review. I hope it fits.

tbsiqueira’s picture

Thank you very much for your work @beatrizrodrigues!

Very good questions @andregp!

I found the deprecation while checking our code with phpStan. Upon diving a bit on the Drupal source files, I found this at the "theme_handler": https://git.drupalcode.org/project/drupal/-/blob/8.9.x/core/lib/Drupal/C...

For setException() I followed the method implemented at vendor/symfony/http-kernel/Event/GetResponseForExceptionEvent.php that has a comment that this method is deprecated from Symfony 4.4.

Please let me know if this answer your question!

Kind regards.

tbsiqueira’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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