Skip to content

Commit a7e21d3

Browse files
committed
Don't marshal arrays to 1.
1 parent 2e91a0e commit a7e21d3

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/Database/Type/IntegerType.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,9 @@ public function marshal($value)
130130
if ($value === null || $value === '') {
131131
return null;
132132
}
133-
if (is_numeric($value) || ctype_digit($value)) {
133+
if (is_numeric($value)) {
134134
return (int)$value;
135135
}
136-
if (is_array($value)) {
137-
return 1;
138-
}
139136

140137
return null;
141138
}

tests/TestCase/Database/Type/IntegerTypeTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,10 @@ public function testMarshal()
159159
$this->assertNull($result);
160160

161161
$result = $this->type->marshal(['3', '4']);
162-
$this->assertSame(1, $result);
162+
$this->assertNull($result);
163+
164+
$result = $this->type->marshal('+0123.45e2');
165+
$this->assertSame(12345, $result);
163166
}
164167

165168
/**

0 commit comments

Comments
 (0)