From 8762b8507697674830c4cfa3d73b279e823f5f4e Mon Sep 17 00:00:00 2001 From: Wisdom Ebong Date: Mon, 25 Mar 2024 15:05:27 +0100 Subject: [PATCH] chore: cast post value with type int to php int --- .../V5/Actions/Post/Handlers/AbstractPostCommandHandler.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Ushahidi/Modules/V5/Actions/Post/Handlers/AbstractPostCommandHandler.php b/src/Ushahidi/Modules/V5/Actions/Post/Handlers/AbstractPostCommandHandler.php index da33bc4dd8..d241a0f5e1 100644 --- a/src/Ushahidi/Modules/V5/Actions/Post/Handlers/AbstractPostCommandHandler.php +++ b/src/Ushahidi/Modules/V5/Actions/Post/Handlers/AbstractPostCommandHandler.php @@ -66,7 +66,6 @@ protected function savePostValues(Post $post, array $post_content, int $post_id) } - $class_name = "Ushahidi\Modules\V5\Models\PostValues\Post" . ucfirst($type); if (!class_exists($class_name) && in_array( @@ -105,6 +104,10 @@ protected function savePostValues(Post $post, array $post_content, int $post_id) $value_meta = $field['value']['value_meta'] ?? []; $value_translations = $field['value']['translations'] ?? []; + if ($type === 'int' && isset($value)) { + $value = (int) $value; + } + if ($type === 'geometry') { if (is_string($value) && $value === '') { $value = null;