• Hello,

    I would like to make you aware of potentially nasty bug in your plugin.

    In cleverreach-wp\Components\class-wp-clever-reach-widget.php on line 97 there is widget_title filter applied as follows:

    $title = apply_filters( 'widget_title', $form->getName() );
    

    The problem is the widget_title filter expects to be given three parameters, see: https://developer.www.ads-software.com/reference/hooks/widget_title/

    I wanted to use the widget_title filter to change widget title for your widget only, so I added following snippet to my theme’s functions.php:

    add_filter('widget_title', function (string $title, array $instance, $id_base): string {
        return ($id_base === 'wp_cleverreach')
            ? 'Melden Sie sich für unseren Newsletter an'
            : $title
        ;
    }, 10, 3);
    

    However, this resulted in “PHP Fatal error: Uncaught ArgumentCountError: Too few arguments to function {closure}(), 1 passed in […] and exactly 3 expected.”

    The solution is to pass the additional two arguments – the fix is as easy as changing the line 97 to:

    $title = apply_filters( 'widget_title', $form->getName(), $instance, $this->id_base );
    
Viewing 1 replies (of 1 total)
  • Plugin Author CleverReach?

    (@cleverreach43)

    Dear Mr Przywara

    thank you very much for this information.
    As we wrote about this topic via the other tool, I close this question.
    We have solved this glitch and it will be available with the next update.

    Best regards

    Dennis Schr?der

Viewing 1 replies (of 1 total)
  • The topic ‘Prevent possible fatal error’ is closed to new replies.