Skip to content

PHP Notices for undefined constants #7

@jphorn

Description

@jphorn

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

Metadata

Metadata

Labels

P1Medium priorityType: BugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions