Browse Source

check string

Tomas Saghy 7 years ago
parent
commit
85586b81bf
2 changed files with 2 additions and 2 deletions
  1. 1 1
      src/Database/Type/DecimalType.php
  2. 1 1
      src/Database/Type/FloatType.php

+ 1 - 1
src/Database/Type/DecimalType.php

@@ -157,7 +157,7 @@ class DecimalType extends Type implements TypeInterface, BatchCastingInterface
         if (is_numeric($value)) {
             return (float)$value;
         }
-        if (preg_match('/[^0-9,. ]/', $value)) {
+        if (is_string($value) && preg_match('/[^0-9,. ]/', $value)) {
             return null;
         }
 

+ 1 - 1
src/Database/Type/FloatType.php

@@ -146,7 +146,7 @@ class FloatType extends Type implements TypeInterface, BatchCastingInterface
         if (is_numeric($value)) {
             return (float)$value;
         }
-        if (preg_match('/[^0-9,. ]/', $value)) {
+        if (is_string($value) && preg_match('/[^0-9,. ]/', $value)) {
             return null;
         }