From d7f3d25b2aa8e81ff6a8a65a71437f562dace15c Mon Sep 17 00:00:00 2001 From: Ivan Lanin Date: Tue, 27 May 2014 01:08:54 +0700 Subject: [PATCH] #248 More flexible checking for float value --- src/PhpWord/Style/AbstractStyle.php | 2 +- src/PhpWord/Style/Image.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/PhpWord/Style/AbstractStyle.php b/src/PhpWord/Style/AbstractStyle.php index 8167c4d2..13ef8f9b 100644 --- a/src/PhpWord/Style/AbstractStyle.php +++ b/src/PhpWord/Style/AbstractStyle.php @@ -245,7 +245,7 @@ abstract class AbstractStyle if (is_string($value) && (preg_match('/[^\d\.\,]/', $value) == 0)) { $value = floatval($value); } - if (!is_float($value)) { + if (!is_numeric($value)) { $value = $default; } diff --git a/src/PhpWord/Style/Image.php b/src/PhpWord/Style/Image.php index f816b32f..1de51870 100644 --- a/src/PhpWord/Style/Image.php +++ b/src/PhpWord/Style/Image.php @@ -250,7 +250,7 @@ class Image extends AbstractStyle */ public function setMarginTop($value = 0) { - $this->marginTop = $this->setFloatVal($value, 0); + $this->marginTop = $this->setNumericVal($value, 0); return $this; } @@ -273,7 +273,7 @@ class Image extends AbstractStyle */ public function setMarginLeft($value = 0) { - $this->marginLeft = $this->setFloatVal($value, 0); + $this->marginLeft = $this->setNumericVal($value, 0); return $this; }