From 92f454c36dde062dc0854b5df0ea4f72f923e20a Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Wed, 28 May 2014 10:20:34 +0000 Subject: [PATCH] Chart\InlinePie: locale-ignorant casts for floats PHP respects locales (LC_NUMERIC) when casting floats to string. That affected the generated HTML for our inline pie charts. This patch is not that beautiful - but fixes this. fixes #6348 --- library/Icinga/Web/Widget/Chart/InlinePie.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/library/Icinga/Web/Widget/Chart/InlinePie.php b/library/Icinga/Web/Widget/Chart/InlinePie.php index 4b9152b88..48416b8ec 100644 --- a/library/Icinga/Web/Widget/Chart/InlinePie.php +++ b/library/Icinga/Web/Widget/Chart/InlinePie.php @@ -220,12 +220,17 @@ EOD; public function render() { $template = $this->template; + // Locale-ignorant string cast: + $data = array(); + foreach ($this->data as $dat) { + $data[] = sprintf('%F', $dat); + } $template = preg_replace('{{url}}', $this->url, $template); $template = preg_replace('{{width}}', $this->width, $template); $template = preg_replace('{{height}}', $this->height, $template); $template = preg_replace('{{title}}', $this->title, $template); $template = preg_replace('{{style}}', $this->style, $template); - $template = preg_replace('{{data}}', implode(',', $this->data), $template); + $template = preg_replace('{{data}}', implode(',', $data), $template); $template = preg_replace('{{colors}}', implode(',', $this->colors), $template); return $template; }