HomePhabricator

Addressing some PHP 8 incompatibilities

Description

Addressing some PHP 8 incompatibilities

Summary:
Starting with a new instance running PHP 8.2, address all exceptions that come up through some basic browsing/usage.

For strlen(null) issues I generally tried to resolve if the value should be non-null at the point of issue, and attempt to address at earlier call-site. There were not many of these that I could determine. In the rest of those cases I would replace with a null-and-strlen check, or use phutil_nonempty_string if I was certain the value was a string and it was more convenient.

Hitting all code-paths is challenging, so I would search for strlen within radius of files I was modifying and evaluate to address those uses in the same manner.

Notes:

  • AphrontRequest::getStr only ever returns a string, and is safe to use phutil_nonempty_string.
  • PhabricatorEnv::getEnvConfig can return non-string things so any values coming from there should never use phutil_nonempty_string.
  • AphrontRequest::getHTTPHeader indicates it could return wild so phutil_nonempty_string should not be used.
  • AphrontRequest::getURIData isn't clear if it could return non-string data, so never use phutil_nonempty_string.

Refs T13588

Test Plan: I'm running an instance on 8.2 and went through the basic setup/installation, startup and usage, including setup issues and configurations/settings.

Reviewers: Blessed Reviewers, epriestley

Reviewed By: Blessed Reviewers, epriestley

Subscribers: aklapper, Korvin, epriestley

Maniphest Tasks: T13588

Differential Revision: https://secure.phabricator.com/D21862

Details

Provenance
cspeckmimAuthored on May 7 2023, 10:37 PM
cspeckmimPushed on May 24 2023, 9:10 PM
Reviewer
Blessed Reviewers
Differential Revision
D21862: Addressing some PHP 8 incompatibilities
Parents
rPbc6f4786a2e3: Fix support for pk-zip compressed figlet font files
Branches
Unknown
Tags
Unknown
Tasks
T13588: PHP 8 Compatibility