Skip to content

Commit d7f3d25

Browse files
committed
#248 More flexible checking for float value
1 parent d9a2c4c commit d7f3d25

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/PhpWord/Style/AbstractStyle.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ protected function setFloatVal($value, $default = null)
245245
if (is_string($value) && (preg_match('/[^\d\.\,]/', $value) == 0)) {
246246
$value = floatval($value);
247247
}
248-
if (!is_float($value)) {
248+
if (!is_numeric($value)) {
249249
$value = $default;
250250
}
251251

src/PhpWord/Style/Image.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ public function getMarginTop()
250250
*/
251251
public function setMarginTop($value = 0)
252252
{
253-
$this->marginTop = $this->setFloatVal($value, 0);
253+
$this->marginTop = $this->setNumericVal($value, 0);
254254

255255
return $this;
256256
}
@@ -273,7 +273,7 @@ public function getMarginLeft()
273273
*/
274274
public function setMarginLeft($value = 0)
275275
{
276-
$this->marginLeft = $this->setFloatVal($value, 0);
276+
$this->marginLeft = $this->setNumericVal($value, 0);
277277

278278
return $this;
279279
}

0 commit comments

Comments
 (0)