Custom contribution field of type money crashes if it has a blank value when viewing contribution
- Create a custom field for contributions of type money and single-line input (text).
- View any existing contribution where you haven't updated it yet.
- Crash.
This is basically the same as https://github.com/civicrm/civicrm-core/pull/22427, but I'll note that CRM_Core_BAO_CustomField::displayValue() also ends up with a similar error with such a field defined but by directly calling money formatting from php not via smarty, just I don't have a way at the moment to reproduce on master, possibly because of the recent token changes, but is still a theoretical issue.
Brick\Math\Exception\NumberFormatException: "The given value "" does not represent a valid number."
0 .../civicrm/vendor/brick/math/src/BigNumber.php(119): Brick\Math\BigNumber::Brick\Math\{closure}()
1 .../civicrm/vendor/brick/money/src/Money.php(196): Brick\Math\BigNumber::of("")
2 .../civicrm/Civi/Core/Format.php(43): Brick\Money\Money::of("", Object(Brick\Money\Currency), Object(Brick\Money\Context\DefaultContext), 5)
3 .../civicrm/CRM/Core/Smarty/plugins/modifier.crmMoney.php(32): Civi\Core\Format->money("", "USD")
4 .../templates_c/en_US/%%FD/FD4/FD481315%%CustomDataView.tpl.php(79): smarty_modifier_crmMoney("")
5 .../civicrm/packages/Smarty/Smarty.class.php(1914): include("/home/jenkins/bknix-dfl/build/core-22401-55dqr/web/sites/default/files/civicr...")
6 .../templates_c/en_US/%%82/82F/82F38BFE%%ContributionView.tpl.php(375): Smarty->_smarty_include((Array:2))
7 .../civicrm/packages/Smarty/Smarty.class.php(1914): include("/home/jenkins/bknix-dfl/build/core-22401-55dqr/web/sites/default/files/civicr...")
8 .../templates_c/en_US/%%5E/5EA/5EA30681%%Tab.tpl.php(12): Smarty->_smarty_include((Array:2))
9 .../civicrm/packages/Smarty/Smarty.class.php(1914): include("/home/jenkins/bknix-dfl/build/core-22401-55dqr/web/sites/default/files/civicr...")
10 .../templates_c/en_US/%%0C/0CB/0CBEC124%%default.tpl.php(19): Smarty->_smarty_include((Array:2))
11 .../civicrm/packages/Smarty/Smarty.class.php(1914): include("/home/jenkins/bknix-dfl/build/core-22401-55dqr/web/sites/default/files/civicr...")
12 .../templates_c/en_US/%%F7/F77/F77C7890%%CMSPrint.tpl.php(51): Smarty->_smarty_include((Array:2))
13 .../civicrm/packages/Smarty/Smarty.class.php(1914): include("/home/jenkins/bknix-dfl/build/core-22401-55dqr/web/sites/default/files/civicr...")
14 .../templates_c/en_US/%%06/069/0693F89E%%drupal.tpl.php(6): Smarty->_smarty_include((Array:2))
15 .../civicrm/packages/Smarty/Smarty.class.php(1273): include("/home/jenkins/bknix-dfl/build/core-22401-55dqr/web/sites/default/files/civicr...")
16 .../civicrm/CRM/Core/Smarty.php(194): Smarty->fetch("CRM/common/drupal.tpl", NULL, NULL, FALSE)
17 .../civicrm/CRM/Core/Page.php(244): CRM_Core_Smarty->fetch("CRM/common/drupal.tpl")
18 .../civicrm/CRM/Contribute/Page/Tab.php(463): CRM_Core_Page->run()
19 .../civicrm/CRM/Core/Invoke.php(319): CRM_Contribute_Page_Tab->run((Array:4), NULL)
20 .../civicrm/CRM/Core/Invoke.php(69): CRM_Core_Invoke::runItem((Array:13))
21 .../civicrm/CRM/Core/Invoke.php(36): CRM_Core_Invoke::_invoke((Array:4))
22 .../civicrm/drupal/civicrm.module(471): CRM_Core_Invoke::invoke((Array:4))
23 .../web/includes/menu.inc(527): civicrm_invoke("contact", "view", "contribution")
24 .../web/index.php(21): menu_execute_active_handler()
25 {main}