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

Fix fatal error when "admin_post_thumbnail_html" filter is applied with null "$thumbnail_id" param #196

Merged
merged 2 commits into from
Apr 25, 2024

Conversation

kmgalanakis
Copy link
Contributor

Description of the Change

The admin_post_thumbnail_html filter is allowing the $thumbnail_id parameter to be null or undefined but the when a callback for that hook is registered in the plugin, the $thumbnail_id parameter is set to always be defined, thus filter application with just two arguments are throwing fatal errors when the plugin is activated.

Closes #195

How to test the Change

  • In the theme's functions.php file add the following command
add_action( 'init', 'testing_safe_svg' );
function testing_safe_svg() {
	$content = apply_filters( 'admin_post_thumbnail_html', '', 1 );
}

Changelog Entry

Fixed - Fatal error when applying the "admin_post_thumbnail_html" with just two arguments.

Credits

Props @kmgalanakis

Checklist:

  • I agree to follow this project's Code of Conduct.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests pass.

@kmgalanakis kmgalanakis self-assigned this Apr 25, 2024
@kmgalanakis kmgalanakis added the needs:code-review This requires code review. label Apr 25, 2024
@dkotter dkotter added this to the 2.3.0 milestone Apr 25, 2024
@dkotter dkotter merged commit 3a3313c into develop Apr 25, 2024
13 checks passed
@dkotter dkotter deleted the fix/fatal-error-when-filter-called-with-less-args branch April 25, 2024 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs:code-review This requires code review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SafeSVG fatal error
2 participants