Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP Notices for undefined constants #7

Closed
jphorn opened this issue Jun 20, 2019 · 4 comments · Fixed by #32
Closed

PHP Notices for undefined constants #7

jphorn opened this issue Jun 20, 2019 · 4 comments · Fixed by #32
Assignees
Labels
P1 Medium priority Type: Bug Something isn't working
Milestone

Comments

@jphorn
Copy link

jphorn commented Jun 20, 2019

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):

  • PHP Version: 7.2.14
  • OS: macOS (Mamp Pro)
  • Browser Safari 12.1.1/macOS
  • Plugin Version: 1.0.0.beta.1
  • Device: MacBook Pro 2018

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

Changelog entry

  • Check if LOGGED_IN_KEY and LOGGED_IN_SALT are defined before using it, to account for some environments such as local ones.

Acceptance criteria

@jamesozzie jamesozzie added the Type: Bug Something isn't working label Jun 20, 2019
@jamesozzie
Copy link
Collaborator

Thanks for the context, will pass this on now.

@ThierryA ThierryA added the P1 Medium priority label Jun 20, 2019
@ThierryA ThierryA added this to the Hot Fixes Release milestone Jun 20, 2019
@ivankristianto ivankristianto self-assigned this Jun 21, 2019
@ivankristianto
Copy link
Contributor

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
Copy link
Author

jphorn commented Jun 22, 2019

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

@ThierryA
Copy link
Collaborator

@bjackson27 has this been QA'ed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P1 Medium priority Type: Bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants