Skip to content

Commit

Permalink
Don't marshal arrays to 1.
Browse files Browse the repository at this point in the history
  • Loading branch information
ADmad committed Aug 15, 2018
1 parent 2e91a0e commit a7e21d3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
5 changes: 1 addition & 4 deletions src/Database/Type/IntegerType.php
Expand Up @@ -130,12 +130,9 @@ public function marshal($value)
if ($value === null || $value === '') {
return null;
}
if (is_numeric($value) || ctype_digit($value)) {
if (is_numeric($value)) {
return (int)$value;
}
if (is_array($value)) {
return 1;
}

return null;
}
Expand Down
5 changes: 4 additions & 1 deletion tests/TestCase/Database/Type/IntegerTypeTest.php
Expand Up @@ -159,7 +159,10 @@ public function testMarshal()
$this->assertNull($result);

$result = $this->type->marshal(['3', '4']);
$this->assertSame(1, $result);
$this->assertNull($result);

$result = $this->type->marshal('+0123.45e2');
$this->assertSame(12345, $result);
}

/**
Expand Down

0 comments on commit a7e21d3

Please sign in to comment.