Support » Plugin: Quick Paypal Payments » Undefined variable: inputfont, selectfont, font, submitfont, header, bg

  • Larry Daniele

    (@larrydaniele)



    On a system with QPP 5.5.2 and PHP 7.1, I see this block of log entries in the WordPress debug_log quite often:

    [21-Nov-2017 17:07:44 UTC] PHP Notice: Undefined variable: inputfont in /home/holycowom/public_html/wp-content/plugins/quick-paypal-payments/quick-paypal-payments.php on line 1628
    [21-Nov-2017 17:07:44 UTC] PHP Notice: Undefined variable: selectfont in /home/holycowom/public_html/wp-content/plugins/quick-paypal-payments/quick-paypal-payments.php on line 1629
    [21-Nov-2017 17:07:44 UTC] PHP Notice: Undefined variable: inputfont in /home/holycowom/public_html/wp-content/plugins/quick-paypal-payments/quick-paypal-payments.php on line 1630
    [21-Nov-2017 17:07:44 UTC] PHP Notice: Undefined variable: font in /home/holycowom/public_html/wp-content/plugins/quick-paypal-payments/quick-paypal-payments.php on line 1632
    [21-Nov-2017 17:07:44 UTC] PHP Notice: Undefined variable: submitfont in /home/holycowom/public_html/wp-content/plugins/quick-paypal-payments/quick-paypal-payments.php on line 1642
    [21-Nov-2017 17:07:44 UTC] PHP Notice: Undefined variable: submitfont in /home/holycowom/public_html/wp-content/plugins/quick-paypal-payments/quick-paypal-payments.php on line 1645
    [21-Nov-2017 17:07:44 UTC] PHP Notice: Undefined variable: header in /home/holycowom/public_html/wp-content/plugins/quick-paypal-payments/quick-paypal-payments.php on line 1664
    [21-Nov-2017 17:07:44 UTC] PHP Notice: Undefined variable: bg in /home/holycowom/public_html/wp-content/plugins/quick-paypal-payments/quick-paypal-payments.php on line 1665

    It appears that this is because the initial definition of these variables appears inside an “if” statement in function qpp_generate_css(), but are referenced outside the “if” statement. So if the “if” statement isn’t executed, the variables are undefined.

    I believe this can be resolved by inserting these initializers outside of the if statement at the top of the foreach loop (around line 1619):

        $font = '';
        $inputfont = '';
        $selectfont = '';
        $submitfont = '';
        $bg = '';
        $header = '';

    I did this on my site and the PHP Notices no longer appear. I hope this fix can make it into the official code if you think it is appropriate. Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author aerin

    (@aerin)

    Hi Larry,

    Thanks for the heads up on this. I’ll get the sorted for the next update.

    You can simplify the code and just use:

    $font = $inputfont = $selectfont = $submitfont = $bg = $header = false;

    hightechdad

    (@hightechdad)

    Any ETA on the next update? I’m debating if I should try this fix but there are two if statements right near where you were mentioning. And I don’t want to break anything.

    Plugin Author aerin

    (@aerin)

    I’m just finishing off a GDPR consent option for the plugin so it should be soon.

    But if you want an early update to test you can get it from here: https://quick-plugins.com/quick-paypal-payments/qpp-update/

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Undefined variable: inputfont, selectfont, font, submitfont, header, bg’ is closed to new replies.