1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 14:52:41 +01:00

Make omitting "value" from a transaction description an explicit error

Summary: See PHI1710. Until D21044, some transactions could omit "value" and apply correctly. This now throws an exception when accessing `$xaction['value']`. All transactions are expected to have a "value" key, so require it explicitly rather than implicitly.

Test Plan: Submitted a transaction with a "type" but no "value". After D21044, got a language-level exception. After this change, got an explicit exception.

Differential Revision: https://secure.phabricator.com/D21176
This commit is contained in:
epriestley 2020-04-27 13:12:05 -07:00
parent 604811bfc5
commit b5bed7b0fa

View file

@ -2204,6 +2204,16 @@ abstract class PhabricatorEditEngine
$transactions_key, $transactions_key,
$key)); $key));
} }
if (!array_key_exists('value', $xaction)) {
throw new Exception(
pht(
'Parameter "%s" must contain a list of transaction descriptions, '.
'but item with key "%s" is missing a "value" field. Each '.
'transaction must have a value field.',
$transactions_key,
$key));
}
} }
return $xactions; return $xactions;