From 72e6af034447c7ca220e7dab35ed68c87522f2f0 Mon Sep 17 00:00:00 2001 From: Ruslan Kabalin Date: Tue, 31 May 2011 11:18:11 +0100 Subject: [PATCH] MDL-27171 messages: fix static variable filtering bug in get_message_processors Static $processors should contain the full list of processors only, when filtering is required, the $processors variable should not be updated. Lambda function refactoring is made as well. Signed-off-by: Ruslan Kabalin --- message/lib.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/message/lib.php b/message/lib.php index 14b36bd2731..3458eed61bb 100644 --- a/message/lib.php +++ b/message/lib.php @@ -2286,8 +2286,14 @@ function get_message_processors($ready = false) { } } if ($ready) { - // Filter out enabled, available and system_configured processors only. - $processors = array_filter($processors, create_function('$a', 'return $a->enabled && $a->configured;')); + // Filter out enabled and system_configured processors + $readyprocessors = $processors; + foreach ($readyprocessors as $readyprocessor) { + if (!($readyprocessor->enabled && $readyprocessor->configured)) { + unset($readyprocessors[$readyprocessor->name]); + } + } + return $readyprocessors; } return $processors;