1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-26 08:42:41 +01:00

Fix PHP 8.1 "strlen(null)" exception which blocks rendering Conduit's dashboard.panel.edit 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 T15425

Test Plan: Applied this change; afterwards `/conduit/method/dashboard.panel.edit/` correctly renders in browser.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15425

Differential Revision: https://we.phorge.it/D25257
This commit is contained in:
Andre Klapper 2023-05-30 10:56:51 +02:00
parent 2a9eca696f
commit 72fdf232b4
2 changed files with 10 additions and 1 deletions

View file

@ -95,7 +95,7 @@ abstract class PhabricatorEditEngineAPIMethod
$section[] = $type->getConduitDescription(); $section[] = $type->getConduitDescription();
$type_documentation = $type->getConduitDocumentation(); $type_documentation = $type->getConduitDocumentation();
if (strlen($type_documentation)) { if (phutil_nonempty_string($type_documentation)) {
$section[] = $type_documentation; $section[] = $type_documentation;
} }

View file

@ -169,11 +169,20 @@ abstract class PhabricatorEditField extends Phobject {
return $this->conduitDescription; return $this->conduitDescription;
} }
/**
* Set the Conduit documentation in raw Remarkup.
* @param string|null $conduit_documentation
* @return self
*/
public function setConduitDocumentation($conduit_documentation) { public function setConduitDocumentation($conduit_documentation) {
$this->conduitDocumentation = $conduit_documentation; $this->conduitDocumentation = $conduit_documentation;
return $this; return $this;
} }
/**
* Get the Conduit documentation in raw Remarkup.
* @return string|null
*/
public function getConduitDocumentation() { public function getConduitDocumentation() {
return $this->conduitDocumentation; return $this->conduitDocumentation;
} }