Fatal error: Type of Drupal\svg_image_responsive\Plugin\Field\FieldFormatter\SvgResponsiveImageFormatter::$fileUrlGenerator must be Drupal\Core\File\FileUrlGeneratorInterface (as in class Drupal\responsive_image\Plugin\Field\FieldFormatter\ResponsiveImageFormatter)

Issue fork svg_image-3592477

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

o_timoshchuk created an issue. See original summary.

o_timoshchuk’s picture

Version: 3.x-dev » 3.2.2
o_timoshchuk’s picture

Version: 3.2.2 » 3.x-dev

o_timoshchuk’s picture

Status: Active » Needs review
StatusFileSize
new1.41 KB

I have verified that the issue appeared in Drupal Core 11.3.10, as the ResponsiveImageFormatter parent class was updated.

The patch was tested successfully.

hosterholz made their first commit to this issue’s fork.

hosterholz’s picture

MR !59 breaks compatibility with Drupal 11.3 and earlier.
To preserve backward compatibility, only add a type hint to the $fileUrlGenerator property.

orkutmuratyilmaz’s picture

When I upgrade my core version to 11.4.0-rc2, I get the error message below:

Fatal error: Type of Drupal\svg_image_responsive\Plugin\Field\FieldFormatter\SvgResponsiveImageFormatter::$fileUrlGenerator must be Drupal\Core\File\FileUrlGeneratorInterface (as in class Drupal\responsive_image\Plugin\Field\FieldFormatter\ResponsiveImageFormatter) in /var/www/html/web/modules/contrib/svg_image/modules/svg_image_responsive/src/Plugin/Field/FieldFormatter/SvgResponsiveImageFormatter.php on line 28

tregonia’s picture

As previously reported for the rc version, updating to Drupal 11.4.0 official release throws a fatal error and bricks the site.

Fatal error: Type of Drupal\svg_image_responsive\Plugin\Field\FieldFormatter\SvgResponsiveImageFormatter::$fileUrlGenerator must be Drupal\Core\File\FileUrlGeneratorInterface (as in class Drupal\responsive_image\Plugin\Field\FieldFormatter\ResponsiveImageFormatter) in /home/ide/project/docroot/modules/contrib/svg_image/modules/svg_image_responsive/src/Plugin/Field/FieldFormatter/SvgResponsiveImageFormatter.php on line 28

tregonia’s picture

Status: Needs review » Reviewed & tested by the community

Created the merge request from the branch in #7. Tested with Drupal 11.4.0 and confirmed that the type change resolved the issue.

RTBC+1

siramsay’s picture

StatusFileSize
new1.52 KB

Tested the patch from #62 to do a D10 => D11 upgrade to 11.4.0 and it worked.

Prior to patch I got Fatal error: Type of Drupal\svg_image_responsive\Plugin\Field\FieldFormatter\SvgResponsiveImageFormatter::$fileUrlGenerator

RTBC+1

Adding patch for reference

anybody made their first commit to this issue’s fork.

anybody’s picture

Priority: Critical » Normal
Status: Reviewed & tested by the community » Needs work

For the reasons given I'm merging MR!62, but we should consider a 4.x version compatible with Drupal ^11.4|| ^12 which removes this like in MR!59.

Leaving this open for that reason.

anybody’s picture

Assigned: o_timoshchuk » Unassigned
Issue tags: +Needs tests

Closing #3608004: Fix incompatible $fileUrlGenerator redeclaration in SVG responsive image formatter which is well documented. I agree there should be a test that should have failed with this broken implementation.

  • anybody committed 90e2f544 on 3.x
    refs #3592477: Fix SvgResponsiveImageFormatter error.
    

  • anybody committed e89e9d36 on 3.x
    Revert "refs #3592477: Fix SvgResponsiveImageFormatter error."
    
    This...
anybody’s picture

Reverted, I accidentally merged the wrong MR. See #14 which is still correct.