• 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)
Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Undefined variable: inputfont, selectfont, font, submitfont, header, bg’ is closed to new replies.