@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
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix PHP 8.1 "strlen(null)" exceptions for empty pattern in DiffusionQueryPathsConduitAPIMethod

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.

```
DiffusionQueryPathsConduitAPIMethod.php:85: strlen(): Passing null to parameter #1 ($string) of type string is deprecated
DiffusionQueryPathsConduitAPIMethod.php:93: 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/D26698

+2 -2
+2 -2
src/applications/diffusion/conduit/DiffusionQueryPathsConduitAPIMethod.php
··· 82 82 $limit = (int)$request->getValue('limit'); 83 83 $offset = (int)$request->getValue('offset'); 84 84 85 - if (strlen($pattern)) { 85 + if (phutil_nonempty_string($pattern)) { 86 86 // Add delimiters to the regex pattern. 87 87 $pattern = '('.$pattern.')'; 88 88 } ··· 90 90 $results = array(); 91 91 $count = 0; 92 92 foreach ($lines as $line) { 93 - if (strlen($pattern) && !preg_match($pattern, $line)) { 93 + if (phutil_nonempty_string($pattern) && !preg_match($pattern, $line)) { 94 94 continue; 95 95 } 96 96