Skip to content

Review PHP deprecation notices with PHP 8.1+ #8589

@jamesozzie

Description

@jamesozzie

Bug Description

As reported by one user in the forums, there are deprecation notices stemming from the plugin, and not part of any third party dependency. These can be seem below:

E_DEPRECATED htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated in file /wp-content/plugins/google-site-kit/includes/Core/Authentication/Clients/OAuth_Client.php on line 403

E_DEPRECATED strtotime(): Passing null to parameter #1 ($datetime) of type string is deprecated in file /wp-content/plugins/google-site-kit/includes/Modules/Analytics_4/Report.php on line 112

E_DEPRECATED htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated in file /wp-content/plugins/google-site-kit/includes/Core/Authentication/Setup.php on line 234

Testing underway, with more insights and log files to be provided.


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

Acceptance criteria

  • The code base should be audited for usage that raises PHP deprecations
  • PHP deprecation messages should cause tests to fail

Implementation Brief

Test Coverage

  • No new coverage to add
  • If possible, update PHPUnit test matrix to run on PHP 8.1 or 8.2 instead of 8.0

QA Brief

  • Using a web server running PHP 8.1 (or above)
  • Do overall smoke testing of the Site Kit and general modules
  • Verify that there are no deprecation or other notices in the error log

Changelog entry

  • Fix PHP 8.1 deprecation notices.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1Medium priorityPHPTeam SIssues for Squad 1Type: EnhancementImprovement of an existing featureType: SupportSupport request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions