pfefferle / wordpress-webmention

A Webmention plugin for WordPress
https://wordpress.org/plugins/webmention/
MIT License
117 stars 31 forks source link

Fatal in v5.1.5 with single posts and pages #435

Closed cagrimmett closed 11 months ago

cagrimmett commented 11 months ago

The v5.1.5 update fataled a couple of my sites when it autoupdated an hour ago.

PHP Fatal error: Uncaught ArgumentCountError: Too few arguments to function webmentions_open(), 0 passed in /srv/htdocs/wp-content/plugins/webmention/includes/class-discovery.php on line 126 and exactly 1 expected in /srv/htdocs/wp-content/plugins/webmention/includes/functions.php:535 
Stack trace: 
#0 /srv/htdocs/wp-content/plugins/webmention/includes/class-discovery.php(126): webmentions_open() 
#1 /srv/htdocs/wp-content/plugins/webmention/includes/class-discovery.php(116): Webmention\Discovery::should_receive_mentions() 
#2 /srv/htdocs/wp-content/plugins/webmention/includes/class-discovery.php(44): Webmention\Discovery::should_show_headers() 
#3 /wordpress/core/6.3.2/wp-includes/class-wp-hook.php(310): Webmention\Discovery::http_header('') 
#4 /wordpress/core/6.3.2/wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters(NULL, Array) 
#5 /wordpress/core/6.3.2/wp-includes/plugin.php(517): WP_Hook->do_action(Array) 
#6 /wordpress/core/6.3.2/wp-includes/template-loader.php(13): do_action('template_redire...') 
#7 /wordpress/core/6.3.2/wp-blog-header.php(19): require_once('/wordpress/core...') 
#8 /wordpress/core/6.3.2/index.php(17): require('/wordpress/core...') #9 {main} thrown in /srv/htdocs/wp-content/plugins/webmention/includes/functions.php on line 535

I was able to replicate it on a fresh site with only the webmention plugin installed.

I think the issue is that this line needs get_the_ID() passed to fulfill the function's post object or ID requirement: https://github.com/pfefferle/wordpress-webmention/blob/main/includes/class-discovery.php#L126

It looks like @dshanske is the most recent editor of that line and also released version 5.1.5.

snarfed commented 11 months ago

Confirmed, this hit my site too. Downgrading to 5.1.4 fixed it.

jeherve commented 11 months ago

Same problem in includes/functions.php (line 610), and also introduced in #426.

It should be fixed by #434.

armingrewe commented 11 months ago

Same here, have deactivated plugin for now while waiting for a new version with the fix

deKay01 commented 11 months ago

Same problem here. Can't access WP pages with the plugin enabled.

pfefferle commented 11 months ago

I just merged the PR and released 5.1.6! Sorry about that!

dshanske commented 11 months ago

It's my fault. Sometimes in life, you overlook something extremely simple.