Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2681164
D25220.1734637605.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
1 KB
Referenced Files
None
Subscribers
None
D25220.1734637605.diff
View Options
diff --git a/src/applications/transactions/storage/PhabricatorModularTransactionType.php b/src/applications/transactions/storage/PhabricatorModularTransactionType.php
--- a/src/applications/transactions/storage/PhabricatorModularTransactionType.php
+++ b/src/applications/transactions/storage/PhabricatorModularTransactionType.php
@@ -334,12 +334,28 @@
return $this->getEditor()->getIsNewObject();
}
+ /**
+ * Check whenever a new transaction's value is considered an "empty text"
+ * @param mixed $value A string, null, an integer...
+ * @param array $xactions Transactions
+ */
final protected function isEmptyTextTransaction($value, array $xactions) {
foreach ($xactions as $xaction) {
$value = $xaction->getNewValue();
}
- return !phutil_nonempty_string($value);
+ // The $value can be a lot of stuff, null, string, integer and maybe more.
+ // We cast to string to answer the question "Is this string empty?".
+ // Note: Don't use phutil_nonempty_stringlike() since it was not designed
+ // for integers.
+ // Note: Don't use phutil_nonempty_scalar() since very probably we could
+ // receive a boolean, causing exceptions.
+ // https://we.phorge.it/T15239
+ $value_clean = phutil_string_cast($value);
+
+ // We made our lives easier and we don't need strlen(something)
+ // and we should not.
+ return $value_clean === '';
}
/**
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Dec 19, 19:46 (20 h, 24 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1015452
Default Alt Text
D25220.1734637605.diff (1 KB)
Attached To
Mode
D25220: PhabricatorModularTransactionType: fix regression
Attached
Detach File
Event Timeline
Log In to Comment