mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-25 16:22:43 +01:00
Fix PHP 8.1 "strlen(null)" exception trying to create an empty Menu Item
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 T15398 Test Plan: Applied this change and "Edit Menu Item" overlay dialog correctly shows "You must choose a project" resp. "You must choose a room." error message, now without an exception. Go to /home/menu/configure/custom/ and also to /home/menu/configure/global/ and try: - Add Label with name `0` / `1` / `1.123` etc. - Add Label, Save again - Add Link, Save again - Add Application, Save again - Add Divider, Save again - Add Conpherence, Save again - Add Link, Save Again - Add Motivator (Cat Facts), Save again - Add Form, Save again - Order Items - Activate/Disable Built-in Home (unrelated) - Remove all the above Also, tried on a Project menu. Reviewers: O1 Blessed Committers, valerio.bozzolan Reviewed By: O1 Blessed Committers, valerio.bozzolan Subscribers: avivey, speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno Maniphest Tasks: T15398 Differential Revision: https://we.phorge.it/D25230
This commit is contained in:
parent
19d9da7fea
commit
b1edfea09b
1 changed files with 1 additions and 1 deletions
|
@ -126,7 +126,7 @@ abstract class PhabricatorProfileMenuItem extends Phobject {
|
||||||
$result = $xaction['new'];
|
$result = $xaction['new'];
|
||||||
}
|
}
|
||||||
|
|
||||||
return !strlen($result);
|
return !phutil_nonempty_string($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
final protected function newError($title, $message, $xaction = null) {
|
final protected function newError($title, $message, $xaction = null) {
|
||||||
|
|
Loading…
Reference in a new issue