1
0
Fork 0
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 Maniphest task creation 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 T15302

Test Plan:
Applied these five changes (on top of D25144, D25145, D25146, D25147, D25151)
and `/maniphest/task/edit/form/default/` finally rendered in web browser.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15302

Differential Revision: https://we.phorge.it/D25152
This commit is contained in:
Andre Klapper 2023-05-01 15:51:48 +02:00
parent bccd4f5981
commit 313d3b7bf2
3 changed files with 5 additions and 5 deletions

View file

@ -971,14 +971,14 @@ abstract class PhabricatorEditEngine
}
$page_key = $request->getURIData('pageKey');
if (!strlen($page_key)) {
if (!phutil_nonempty_string($page_key)) {
$pages = $this->getPages($object);
if ($pages) {
$page_key = head_key($pages);
}
}
if (strlen($page_key)) {
if (phutil_nonempty_string($page_key)) {
$page = $this->selectPage($object, $page_key);
if (!$page) {
return new Aphront404Response();
@ -1169,7 +1169,7 @@ abstract class PhabricatorEditEngine
if ($this->getIsCreate()) {
$template = $request->getStr('template');
if (strlen($template)) {
if (phutil_nonempty_string($template)) {
$template_object = $this->newObjectFromIdentifier(
$template,
array(

View file

@ -418,7 +418,7 @@ abstract class PhabricatorEditField extends Phobject {
}
$instructions = $this->getControlInstructions();
if (strlen($instructions)) {
if (phutil_nonempty_string($instructions)) {
$form->appendRemarkupInstructions($instructions);
}

View file

@ -18,7 +18,7 @@ final class PhabricatorTextEditField
$control = new AphrontFormTextControl();
$placeholder = $this->getPlaceholder();
if (strlen($placeholder)) {
if (phutil_nonempty_string($placeholder)) {
$control->setPlaceholder($placeholder);
}