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.
- 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.