• Resolved erikr14

    (@erikr14)


    Hello,

    We are trying to update your plugin to the newest version (4.3.0) but we are running into a fatal error on the options page in the admin. We get this error on the defaults tab and the general tab but for different code lines.

    PHP Fatal error:  Uncaught ArgumentCountError: 8 arguments are required, 4 given in wp-content\plugins\post-expirator\src\Views\menu-general.php:46
    Stack trace:
    #0 wp-content\plugins\post-expirator\src\Views\menu-general.php(46): sprintf('Stel de offset ...', '<a href="https:...', '<code>', '</code>')
    #1 wp-content\plugins\post-expirator\legacy\classes\Display.class.php(459): include('C:\\laragon\\www\\...')
    #2 wp-content\plugins\post-expirator\legacy\classes\Display.class.php(348): PostExpirator_Display->render_template('menu-general', Array)
    #3 wp-content\plugins\post-expirator\legacy\classes\Display.class.php(100): PostExpirator_Display->menu_general()
    #4 wp-content\plugins\post-expirator\legacy\classes\Display.class.php(135): PostExpirator_Display->load_tab('general')
    #5 wp-includes\class-wp-hook.php(324): PostExpirator_Display->settings_tabs('')
    #6 wp-includes\class-wp-hook.php(348): WP_Hook->apply_filters('', Array)
    #7 wp-includes\plugin.php(517): WP_Hook->do_action(Array)
    #8 wp-admin\admin.php(259): do_action('toplevel_page_p...')
    #9 {main}
    thrown in wp-content\plugins\post-expirator\src\Views\menu-general.php on line 46

    It seems the problem has to do with the sprintf function used for the description on those tabs. In the description there is a code to use the 2nd argument in the string but it’s followed by +1 (%2$s+1). This makes the function think that it requires a different argument (at least in PHP 8.2). Adding a space between %2$s and the +1 seems to fix the problem.

    The following lines of code have this issue:

    The variable in file plugins\post-expirator\src\Modules\Settings\Controllers\Controller.php on line 224.

    $fieldDefaultDateTimeOffsetDescription = esc_html__(
    'Set the offset to use for the default action date and time. For information on formatting, see %1$s. For example, you could enter %2$s +1 month%3$s or %2$s+1 week 2 days 4 hours 2 seconds%3$s or %2$snext Thursday%3$s. Please, use only terms in English.',
    'post-expirator'
    );

    And the variable in file plugins\post-expirator\src\Views\menu-general.php on line 41.

    $description = esc_html__(
    'Set the offset to use for the default action date and time. For information on formatting, see %1$s. For example, you could enter %2$s+1 month%3$s or %2$s+1 week 2 days 4 hours 2 seconds%3$s or %2$snext Thursday%3$s. Please, use only terms in English.',
    'post-expirator'
    );

    Would it be possible to implement this fix so we can continue to use your plugin? Considering both are descriptions the impact of the added space should be minimal.

    Thanks in advance!

    • This topic was modified 2 months ago by erikr14.
    • This topic was modified 2 months ago by Yui.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.