mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-22 14:52:41 +01:00
Fix PHP 8.1 "strlen(null)" exceptions which block rendering the Diffusion page
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. Closes T15300 Test Plan: Applied these three changes (on top of D25144, D25145, D25146, D25147) and `/diffusion/` finally rendered in web browser. Reviewers: O1 Blessed Committers, avivey Reviewed By: O1 Blessed Committers, avivey Subscribers: speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno Maniphest Tasks: T15300 Differential Revision: https://we.phorge.it/D25150
This commit is contained in:
parent
562d36ef5f
commit
1b82943419
1 changed files with 3 additions and 3 deletions
|
@ -97,19 +97,19 @@ abstract class DiffusionController extends PhabricatorController {
|
|||
AphrontRequest $request) {
|
||||
|
||||
$short_name = $request->getURIData('repositoryShortName');
|
||||
if (strlen($short_name)) {
|
||||
if (phutil_nonempty_string($short_name)) {
|
||||
// If the short name ends in ".git", ignore it.
|
||||
$short_name = preg_replace('/\\.git\z/', '', $short_name);
|
||||
return $short_name;
|
||||
}
|
||||
|
||||
$identifier = $request->getURIData('repositoryCallsign');
|
||||
if (strlen($identifier)) {
|
||||
if (phutil_nonempty_string($identifier)) {
|
||||
return $identifier;
|
||||
}
|
||||
|
||||
$id = $request->getURIData('repositoryID');
|
||||
if (strlen($id)) {
|
||||
if (phutil_nonempty_string($id)) {
|
||||
return (int)$id;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue