From 1b4e41af17f87d6f63f8b9a257e305bfba00be95 Mon Sep 17 00:00:00 2001 From: Petr Skoda Date: Sun, 24 Jan 2010 19:34:44 +0000 Subject: [PATCH] MDL-21400 fixe null param in js funcion call --- lib/outputcomponents.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/outputcomponents.php b/lib/outputcomponents.php index 6ae45a3b4e2..e72f8c2a7a7 100644 --- a/lib/outputcomponents.php +++ b/lib/outputcomponents.php @@ -574,8 +574,12 @@ class js_writer { * @return string JS code fragment */ public function function_call($function, array $arguments = null, $delay=0) { - $arguments = array_map('json_encode', $arguments); - $arguments = implode(', ', $arguments); + if ($arguments) { + $arguments = array_map('json_encode', $arguments); + $arguments = implode(', ', $arguments); + } else { + $arguments = ''; + } $js = "$function($arguments);"; if ($delay) {