google / site-kit-wp

Site Kit is a one-stop solution for WordPress users to use everything Google has to offer to make them successful on the web.
https://sitekit.withgoogle.com
Apache License 2.0
1.25k stars 291 forks source link

PHP Notices for undefined constants #7

Closed jphorn closed 5 years ago

jphorn commented 5 years ago

Describe the bug PHP warnings for undefined constants LOGGED_IN_KEY and LOGGED_IN_SALT.

To Reproduce Steps to reproduce the behavior:

  1. Install Site Kit plugin
  2. Enable PHP error logging
  3. Activate Site Kit plugin in WordPress
  4. Many PHP warning notices for undefined constants
Warning: Use of undefined constant LOGGED_IN_KEY - assumed 'LOGGED_IN_KEY' (this will throw an Error in a future version of PHP) in example.com/wp-content/plugins/google-site-kit/includes/Core/Storage/Data_Encryption.php on line 118

Warning: Use of undefined constant LOGGED_IN_KEY - assumed 'LOGGED_IN_KEY' (this will throw an Error in a future version of PHP) in example.com/wp-content/plugins/google-site-kit/includes/Core/Storage/Data_Encryption.php on line 119

Warning: Use of undefined constant LOGGED_IN_SALT - assumed 'LOGGED_IN_SALT' (this will throw an Error in a future version of PHP) in example.com/wp-content/plugins/google-site-kit/includes/Core/Storage/Data_Encryption.php on line 138

Warning: Use of undefined constant LOGGED_IN_SALT - assumed 'LOGGED_IN_SALT' (this will throw an Error in a future version of PHP) in example.com/wp-content/plugins/google-site-kit/includes/Core/Storage/Data_Encryption.php on line 139

Warning: Use of undefined constant LOGGED_IN_KEY - assumed 'LOGGED_IN_KEY' (this will throw an Error in a future version of PHP) in example.com/wp-content/plugins/google-site-kit/includes/Core/Storage/Data_Encryption.php on line 118

Warning: Use of undefined constant LOGGED_IN_KEY - assumed 'LOGGED_IN_KEY' (this will throw an Error in a future version of PHP) in example.com/wp-content/plugins/google-site-kit/includes/Core/Storage/Data_Encryption.php on line 119

Warning: Use of undefined constant LOGGED_IN_SALT - assumed 'LOGGED_IN_SALT' (this will throw an Error in a future version of PHP) in example.com/wp-content/plugins/google-site-kit/includes/Core/Storage/Data_Encryption.php on line 138

Warning: Use of undefined constant LOGGED_IN_SALT - assumed 'LOGGED_IN_SALT' (this will throw an Error in a future version of PHP) in example.com/wp-content/plugins/google-site-kit/includes/Core/Storage/Data_Encryption.php on line 139

Warning: Use of undefined constant LOGGED_IN_KEY - assumed 'LOGGED_IN_KEY' (this will throw an Error in a future version of PHP) in example.com/wp-content/plugins/google-site-kit/includes/Core/Storage/Data_Encryption.php on line 118

Warning: Use of undefined constant LOGGED_IN_KEY - assumed 'LOGGED_IN_KEY' (this will throw an Error in a future version of PHP) in example.com/wp-content/plugins/google-site-kit/includes/Core/Storage/Data_Encryption.php on line 119

Warning: Use of undefined constant LOGGED_IN_SALT - assumed 'LOGGED_IN_SALT' (this will throw an Error in a future version of PHP) in example.com/wp-content/plugins/google-site-kit/includes/Core/Storage/Data_Encryption.php on line 138

Warning: Use of undefined constant LOGGED_IN_SALT - assumed 'LOGGED_IN_SALT' (this will throw an Error in a future version of PHP) in example.com/wp-content/plugins/google-site-kit/includes/Core/Storage/Data_Encryption.php on line 139

Warning: Use of undefined constant LOGGED_IN_KEY - assumed 'LOGGED_IN_KEY' (this will throw an Error in a future version of PHP) in example.com/wp-content/plugins/google-site-kit/includes/Core/Storage/Data_Encryption.php on line 118

Warning: Use of undefined constant LOGGED_IN_KEY - assumed 'LOGGED_IN_KEY' (this will throw an Error in a future version of PHP) in example.com/wp-content/plugins/google-site-kit/includes/Core/Storage/Data_Encryption.php on line 119

Warning: Use of undefined constant LOGGED_IN_SALT - assumed 'LOGGED_IN_SALT' (this will throw an Error in a future version of PHP) in example.com/wp-content/plugins/google-site-kit/includes/Core/Storage/Data_Encryption.php on line 138

Warning: Use of undefined constant LOGGED_IN_SALT - assumed 'LOGGED_IN_SALT' (this will throw an Error in a future version of PHP) in example.com/wp-content/plugins/google-site-kit/includes/Core/Storage/Data_Encryption.php on line 139

Warning: Cannot modify header information - headers already sent by (output started at example.com/wp-content/plugins/google-site-kit/includes/Core/Storage/Data_Encryption.php:138) in example.com/wp-admin/includes/misc.php on line 1196

More information and proposed fix.

System Information (please complete the following information):


Do not alter or remove anything below. The following sections will be managed by moderators only.

Changelog entry

Acceptance criteria

jamesozzie commented 5 years ago

Thanks for the context, will pass this on now.

ivankristianto commented 5 years ago

Fixed in #32

@jphorn thanks for reporting this issue. I hope your site is a staging or local environment. But if you have this error on your production site, please consider to add the WordPress salt in your wp-config.php file, https://api.wordpress.org/secret-key/1.1/salt/

jphorn commented 5 years ago

@ivankristianto Yes, this is a local development server :-) Thank you for the fix and feedback.

ThierryA commented 5 years ago

@bjackson27 has this been QA'ed?