As reported by our kind @arnold we have a Crash from the Almanac page:
```
2023/05/12 11:34:13 [error] 6844#6844: *51 FastCGI sent in stderr: "PHP message: [2023-05-12 08:34:13] EXCEPTION: (InvalidArgumentException) Call to phutil_nonempty_string() expected null or a string, got: int. at [<arcanist>/src/utils/utils.php:2127];
PHP message: arcanist(head=master, ref.master=c14785c3795c), phorge(head=master, ref.master=4d9719539773);
PHP message: #0<#2> phutil_nonempty_string(integer) called at [<phorge>/src/applications/transactions/storage/PhabricatorModularTransactionType.php:342];
PHP message: #1 <#2> PhabricatorModularTransactionType::isEmptyTextTransaction(integer, array) called at [<phorge>/src/applications/almanac/xaction/AlmanacInterfacePortTransaction.php:33];
PHP message: #2 <#2> AlmanacInterfacePortTransaction::validateTransactions(AlmanacInterface, array) called at [<phorge>/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php:2871];
PHP message: #3 <#2> PhabricatorApplicationTransactionEditor::validateTransaction(AlmanacInterface, string, array) called at [<phorge>/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php:1234];
PHP message: #4 <#2> PhabricatorApplicationTransactionEditor::applyTransactions(AlmanacInterface, array) called at [<phorge>/src/applications/transactions/editengine/PhabricatorEditEngine.php:1149];
PHP message: #5 <#2> PhabricatorEditEngine::buildEditResponse(AlmanacInterface) called at [<phorge>/src/applications/transactions/editengine/PhabricatorEditEngine.php:1000];
PHP message: #6 <#2> PhabricatorEditEngine::buildResponse() called at [<phorge>/src/applications/almanac/controller/AlmanacInterfaceEditController.php:32];
PHP message: #7 <#2> AlmanacInterfaceEditController::handleRequest(AphrontRequest) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:284];
PHP message: #8 phlog(InvalidArgumentException) called at [<phorge>/src/aphront/handler/PhabricatorDefaultRequestExceptionHandler.php:41];
PHP message: #9 PhabricatorDefaultRequestExceptionHan
```
Regression introduced in:
{D25202}
rP1b08be518ef6219f93dcdad1e34c21855bcdecd4
== Proposed fix ==
```lang=diff
diff --git a/src/applications/transactions/storage/PhabricatorModularTransactionType.php b/src/applications/transactions/storage/PhabricatorModularTransactionType.php
index 3840bcdf9c..a22e4480a0 100644
--- a/src/applications/transactions/storage/PhabricatorModularTransactionType.php
+++ b/src/applications/transactions/storage/PhabricatorModularTransactionType.php
@@ -339,7 +339,8 @@ abstract class PhabricatorModularTransactionType
$value = $xaction->getNewValue();
}
- return !phutil_nonempty_string($value);
+ $value_str = phutil_string_cast($value);
+ return $value_str === '';
}
/**
```
Note that casting is a good idea:
https://www.php.net/manual/en/language.types.string.php#language.types.string.casting
> A bool true value is converted to the string "1". bool false is converted to "" (the empty string). This allows conversion back and forth between bool and string values.
> An int or float is converted to a string representing the number textually (including the exponent part for floats). Floating point numbers can be converted using exponential notation (4.1E+6).
> null is always converted to an empty string.
Note I don't want to use phutil_nonempty_scalar() since it's essentially broken.