mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-26 16: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:
parent
bccd4f5981
commit
313d3b7bf2
3 changed files with 5 additions and 5 deletions
|
@ -971,14 +971,14 @@ abstract class PhabricatorEditEngine
|
||||||
}
|
}
|
||||||
|
|
||||||
$page_key = $request->getURIData('pageKey');
|
$page_key = $request->getURIData('pageKey');
|
||||||
if (!strlen($page_key)) {
|
if (!phutil_nonempty_string($page_key)) {
|
||||||
$pages = $this->getPages($object);
|
$pages = $this->getPages($object);
|
||||||
if ($pages) {
|
if ($pages) {
|
||||||
$page_key = head_key($pages);
|
$page_key = head_key($pages);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strlen($page_key)) {
|
if (phutil_nonempty_string($page_key)) {
|
||||||
$page = $this->selectPage($object, $page_key);
|
$page = $this->selectPage($object, $page_key);
|
||||||
if (!$page) {
|
if (!$page) {
|
||||||
return new Aphront404Response();
|
return new Aphront404Response();
|
||||||
|
@ -1169,7 +1169,7 @@ abstract class PhabricatorEditEngine
|
||||||
if ($this->getIsCreate()) {
|
if ($this->getIsCreate()) {
|
||||||
$template = $request->getStr('template');
|
$template = $request->getStr('template');
|
||||||
|
|
||||||
if (strlen($template)) {
|
if (phutil_nonempty_string($template)) {
|
||||||
$template_object = $this->newObjectFromIdentifier(
|
$template_object = $this->newObjectFromIdentifier(
|
||||||
$template,
|
$template,
|
||||||
array(
|
array(
|
||||||
|
|
|
@ -418,7 +418,7 @@ abstract class PhabricatorEditField extends Phobject {
|
||||||
}
|
}
|
||||||
|
|
||||||
$instructions = $this->getControlInstructions();
|
$instructions = $this->getControlInstructions();
|
||||||
if (strlen($instructions)) {
|
if (phutil_nonempty_string($instructions)) {
|
||||||
$form->appendRemarkupInstructions($instructions);
|
$form->appendRemarkupInstructions($instructions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ final class PhabricatorTextEditField
|
||||||
$control = new AphrontFormTextControl();
|
$control = new AphrontFormTextControl();
|
||||||
|
|
||||||
$placeholder = $this->getPlaceholder();
|
$placeholder = $this->getPlaceholder();
|
||||||
if (strlen($placeholder)) {
|
if (phutil_nonempty_string($placeholder)) {
|
||||||
$control->setPlaceholder($placeholder);
|
$control->setPlaceholder($placeholder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue