Skip to content

Fix/svg avatars 9212 - #9915

Open
boredskull wants to merge 2 commits into
SimpleMachines:release-3.0from
boredskull:fix/svg-avatars-9212
Open

boredskull wants to merge 2 commits into
SimpleMachines:release-3.0from
boredskull:fix/svg-avatars-9212

Conversation

@boredskull

Copy link
Copy Markdown

Description

Fixes #9212.

This pull request addresses several issues affecting SVG avatars in SMF 3.0, including compatibility with PHP versions prior to 8.5, incorrect MIME type handling and access to uninitialised image properties.

Changes

  • Ensures SVG avatars are saved with the correct .svg file extension regardless of native PHP SVG image type support.
  • Corrects an incorrect object reference when checking the MIME type of external avatars.
  • Adds defensive validation to prevent access to uninitialised image type properties.
  • Improves SVG width and height attribute parsing.
  • Prevents potential division-by-zero errors when processing invalid SVG viewBox dimensions.
  • Handles missing or non-finite image dimensions gracefully.
  • Preserves existing SVG security validation and avatar permission checks.

Files Modified

  • Sources/Graphics/Image.php
  • Sources/Profile.php

Backwards Compatibility

The proposed changes do not require database modifications, additional PHP extensions or changes to existing configuration settings.

Existing raster image handling remains unchanged in intent.

Testing

  • Reviewed changes against the current release-3.0 branch.
  • Verified that no unrelated files have been modified.
  • Test SVG avatar uploads on PHP 8.3, 8.4 and 8.5.
  • Test externally hosted SVG avatars.
  • Verify rejection of unsafe or malformed SVG files.
  • Confirm existing PNG, JPEG, GIF and WebP avatar functionality.

Additional Notes

The changes are intentionally limited to image processing and avatar handling. Existing SVG security checks have not been removed or bypassed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[3.0]: SVG not working properly for avatars

1 participant