Skip to content

Commit 6b5a3db

Browse files
authored
remove implicit empty string to null conversion in sanitize() (#223)
2 parents 717b703 + 6e4fdd9 commit 6b5a3db

2 files changed

Lines changed: 1 addition & 5 deletions

File tree

src/Phaseolies/Database/Entity/Model.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -502,10 +502,6 @@ protected function sanitize($value)
502502
{
503503
if (is_string($value)) {
504504
$value = trim($value);
505-
506-
if ($value === '') {
507-
$value = null;
508-
}
509505
}
510506

511507
return $value;

tests/Model/ModelTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public function testAttributeMutation()
9393

9494
// Test empty string becomes null
9595
$model->email = ' ';
96-
$this->assertNull($model->email);
96+
$this->assertNotNull($model->email);
9797
}
9898

9999
public function testMassAssignment()

0 commit comments

Comments
 (0)