From f47eeafdfde024ef29af0154419ab5daa8737e19 Mon Sep 17 00:00:00 2001 From: Juan Leyva Date: Mon, 27 Oct 2014 23:14:13 +0100 Subject: [PATCH] MDL-47916 web services: Fixed invalid returned value type --- mod/forum/externallib.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mod/forum/externallib.php b/mod/forum/externallib.php index 598993558c4..f326af26f1c 100644 --- a/mod/forum/externallib.php +++ b/mod/forum/externallib.php @@ -472,9 +472,13 @@ class mod_forum_external extends external_api { } // Function forum_get_all_discussion_posts adds postread field. - if (!isset($post->postread)) { + // Note that the value returned can be a boolean or an integer. The WS expects a boolean. + if (empty($post->postread)) { $posts[$pid]->postread = false; + } else { + $posts[$pid]->postread = true; } + $posts[$pid]->canreply = $canreply; if (!empty($posts[$pid]->children)) { $posts[$pid]->children = array_keys($posts[$pid]->children);