Undefined Variables

Hi – testing the Patreon plugin, when I click the “Unlock With Patreon” button, I see the following errors on a new page (server and site changed for privacy):

Notice: Undefined variable: client_id in /home/****/dev.mysite.com/wp-content/plugins/patreon-connect/classes/patreon_routing.php on line 158

Notice: Undefined variable: state in /home/****/dev.mysite.com/wp-content/plugins/patreon-connect/classes/patreon_routing.php on line 172

Warning: Cannot modify header information - headers already sent by (output started at /home//dev.mysite.com/wp-content/plugins/patreon-connect/classes/patreon_routing.php:158) in /home//dev.mysite.com/wp-includes/pluggable.php on line 1216

What’s happening here…? Thanks!

1 Like

PHP allows uninitialized variables to be used, but it gives a warning if warnings are configured.

There is no problem or issue with your installation. It would just work. PHP warnings should not be displayed in live sites.

What issue this may cause is that because PHP warnings are displayed by your current installation, headers would be sent before cookies and redirections are set, and this can cause issues.

You seem to be working on a dev location. This location may have errors, notices and warnings turned on, and it apparently does.

In your live location they wouldnt be on. Therefore you shouldnt experience these issues.

1 Like