@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator

Fix PHP 8.1 "strlen(null)" exceptions in HarbormasterLintPropertyView

Summary:
`strlen()` was used in Phabricator to check if a generic value is a non-empty string.
This behavior is deprecated since PHP 8.1. Phorge adopts `phutil_nonempty_string()` as a replacement.

Note: this may highlight other absurd input values that might be worth correcting
instead of just ignoring. If phutil_nonempty_string() throws an exception in your
instance, report it to Phorge to evaluate and fix that specific corner case.

```
HarbormasterLintPropertyView.php:42: strlen(): Passing null to parameter #1 ($string) of type string is deprecated
HarbormasterLintPropertyView.php:49: strlen(): Passing null to parameter #1 ($string) of type string is deprecated
```

Refs T16468

Test Plan: None.

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T16468

Differential Revision: https://we.phorge.it/D26702

+2 -2
+2 -2
src/applications/harbormaster/view/HarbormasterLintPropertyView.php
··· 39 39 $line = $message->getLine(); 40 40 41 41 $href = null; 42 - if (strlen(idx($this->pathURIMap, $path))) { 42 + if (phutil_nonempty_string(idx($this->pathURIMap, $path))) { 43 43 $href = $this->pathURIMap[$path].max($line, 1); 44 44 } 45 45 46 46 $severity = $this->renderSeverity($message->getSeverity()); 47 47 48 48 $location = $path.':'.$line; 49 - if (strlen($href)) { 49 + if (phutil_nonempty_string($href)) { 50 50 $location = phutil_tag( 51 51 'a', 52 52 array(