From 39bb0b7393c32fad520a312f0cf4790b296649e1 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Fri, 8 Jul 2022 09:09:58 -0400 Subject: [PATCH] APIv4 - Fix mishandling of boolean custom values --- Civi/Api4/Generic/AbstractAction.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Civi/Api4/Generic/AbstractAction.php b/Civi/Api4/Generic/AbstractAction.php index 0aa5e8be4b..9347394ada 100644 --- a/Civi/Api4/Generic/AbstractAction.php +++ b/Civi/Api4/Generic/AbstractAction.php @@ -514,6 +514,12 @@ abstract class AbstractAction implements \ArrayAccess { $options = FormattingUtil::getPseudoconstantList($info['field'], $info['expr'], $record, 'create'); $record[$fieldName] = FormattingUtil::replacePseudoconstant($options, $info['val'], TRUE); } + // The DAO works better with ints than booleans. See https://github.com/civicrm/civicrm-core/pull/23970 + foreach ($record as $key => $value) { + if (is_bool($value)) { + $record[$key] = (int) $value; + } + } } /** -- 2.25.1