Support » Plugin: Akismet Spam Protection » Fatal Error: Uncaught ArgumentCountError: 4 arguments are required, 3 given

  • Resolved Umbrovskis.com

    (@rolandinsh)


    Uncaught ArgumentCountError: 4 arguments are required, 3 given in /…/wp-content/plugins/akismet/class.akismet-admin.php:361

    With latest Akismet 4.1.12
    PHP 8.0.9

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter Umbrovskis.com

    (@rolandinsh)

    that is for non-admin users.
    adding ampty string as 4th argument, fixed issue:
    ... 'https://akismet.com/wordpress/', number_format_i18n( $count,0 ), '');

    Plugin Author Christopher Finke

    (@cfinke)

    I’m unable to reproduce this, running WordPress 5.8.1, Akismet 4.1.12, and PHP 8, and looking at the code, I wouldn’t expect to:

    $intro = sprintf( _n(
    	'<a href=&quot;%1$s&quot;>Akismet</a> has protected your site from %2$s spam comment already. ',
    	'<a href=&quot;%1$s&quot;>Akismet</a> has protected your site from %2$s spam comments already. ',
    	$count
    , 'akismet'), 'https://akismet.com/wordpress/', number_format_i18n( $count ) );
    

    sprintf() should only need a total of three arguments: the format string and two values, since there are two placeholders (%1$s and %2$s).

    Is it possible that another plugin you’re running is interfering and modifying the format string via a filter? Or have you manually changed the strings being supplied to _n()?

    Thread Starter Umbrovskis.com

    (@rolandinsh)

    I know, but somehow attributed error got to this line and adding that empty string, fixed.
    As admin used I do not see such issue, only with lower rights (second user).

    Plugin Author Christopher Finke

    (@cfinke)

    Would you mind posting the five lines above line 361 from your copy of class.akismet-admin.php?

    Thread Starter Umbrovskis.com

    (@rolandinsh)

    sure: full if/else block

    if ( $count = get_option('akismet_spam_count') ) {
    	$intro = sprintf(
    		_n(
    		'<a href="%1$s">Akismet</a> has protected your site from %2$s spam comment already. ',
    		'<a href="%1$s">Akismet</a> has protected your site from %2$s spam comments already. ',
    		$count, 
    		'akismet'
    		), 
    	'https://akismet.com/wordpress/',
    	number_format_i18n( $count,0 ), 
    	'');
    } else {
    	$intro = sprintf( __('<a href="%s">Akismet</a> blocks spam from getting to your blog. ', 'akismet'), 'https://akismet.com/wordpress/' );
    }
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Fatal Error: Uncaught ArgumentCountError: 4 arguments are required, 3 given’ is closed to new replies.