Skip to content

Commit

Permalink
Merge "(bug 37352) Boolean issue when using sqlite."
Browse files Browse the repository at this point in the history
  • Loading branch information
jenkins-bot authored and Gerrit Code Review committed Mar 6, 2013
2 parents b7af187 + b9b3d88 commit 3933910
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
6 changes: 1 addition & 5 deletions includes/db/ORMRow.php
Original file line number Diff line number Diff line change
Expand Up @@ -509,11 +509,7 @@ public function setField( $name, $value ) {
$value = (float)$value;
break;
case 'bool':
if ( is_string( $value ) ) {
$value = $value !== '0';
} elseif ( is_int( $value ) ) {
$value = $value !== 0;
}
$value = (bool)$value;
break;
case 'array':
if ( is_string( $value ) ) {
Expand Down
16 changes: 16 additions & 0 deletions tests/phpunit/includes/db/TestORMRowTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,22 @@ public function constructorTestProvider() {
);
}

/**
* @since 1.21
* @return array
*/
protected function getMockValues() {
return array(
'id' => 1,
'str' => 'foobar4645645',
'int' => 42,
'float' => 4.2,
'bool' => '',
'array' => array( 42, 'foobar' ),
'blob' => new stdClass()
);
}

}

class TestORMRow extends ORMRow {}
Expand Down

0 comments on commit 3933910

Please sign in to comment.