file_validate_extensions() removed in D11

Created on 25 February 2025, 3 months ago

Problem/Motivation

GoogleAnalyticsReportsApiAdminSettingsForm.php uses file_validate_extensions() which is deprecated in D10.2 and removed in D11.

Steps to reproduce

Install module on a D11 site and try to upload a credentials.json file.

Proposed resolution

Use the file.validator service.

Remaining tasks

  • ✅ File an issue
  • ➖ Addition/Change/Update/Fix
  • ➖ Testing to ensure no regression
  • ➖ Automated unit testing coverage
  • ➖ Automated functional testing coverage
  • ➖ UX/UI designer responsibilities
  • ➖ Readability
  • ➖ Accessibility
  • ➖ Performance
  • ➖ Security
  • ➖ Documentation
  • ➖ Code review by maintainers
  • ➖ Full testing and approval
  • ➖ Credit contributors
  • ➖ Review with the product owner
  • ➖ Release notes snippet
  • ❌ Release

API changes

  • N/A

Data model changes

  • N/A

Release notes snippet

  • N/A
📌 Task
Status

Active

Version

4.0

Component

API module

Created by

🇦🇺Australia imclean Tasmania

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @imclean
  • 🇦🇺Australia imclean Tasmania
  • First commit to issue fork.
  • 🇮🇳India ggh

    removed deprecated function replaced with file,validator service

  • Status changed to Needs review 4 days ago
  • 🇩🇪Germany Kate Heinlein Berlin

    With this patch I'm getting

    TypeError: Drupal\google_analytics_reports_api\Form\GoogleAnalyticsReportsApiAdminSettingsForm::__construct(): Argument #6 ($file_validator) must be of type Drupal\file\FileValidatorInterface, Drupal\file\Validation\FileValidator given

    Changing the use from
    use Drupal\file\FileValidatorInterface;
    to
    use Drupal\file\Validation\FileValidatorInterface;

    fixes the error.

Production build 0.71.5 2024