Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUGFIX: Check if image is possible to refit on replacement #4753

Merged
merged 1 commit into from
Nov 15, 2023

Conversation

dlubitz
Copy link
Contributor

@dlubitz dlubitz commented Nov 15, 2023

Fixes #4752

Checks if the replacement is an image and has a size.

@dlubitz dlubitz self-assigned this Nov 15, 2023
@dlubitz dlubitz linked an issue Nov 15, 2023 that may be closed by this pull request
1 task
@mhsdesign
Copy link
Member

Im wondering if refit should rather be a noop as checking this beforehand looks kinda weird. Hmm and if we dislike this, i think the refit should throw a readable exception instead of an DivisionByNullError

@dlubitz
Copy link
Contributor Author

dlubitz commented Nov 15, 2023

The whole part is questionable, e.g. method_exists($adjustment, 'refit') should be checked by an interface. But I did't want to refactor that, I just want to get this case fixed for now.

@kitsunet
Copy link
Member

I just want to get this case fixed for now.

Famous last words, but I get it. I think fine for the time being given the state of the thing as of now.

@mhsdesign
Copy link
Member

oki

@mhsdesign
Copy link
Member

there is actually quite a clever way for our method_exists($adjustment, 'refit') to get more transparent:

use @method void refit(object $image) in the interface (as its not breaking), have seen doctrine and symphony doing this

@dlubitz
Copy link
Contributor Author

dlubitz commented Nov 15, 2023

use @method void refit(object $image) in the interface
But which Interface?

@dlubitz dlubitz merged commit 89d793c into 7.3 Nov 15, 2023
9 checks passed
@dlubitz dlubitz deleted the bugfix/image-replace-with-svg branch November 15, 2023 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: Replacing an image with an SVG leads to "division by zero"
4 participants