const TYPE_INTEGER = 1;
const TYPE_STRING = 2;
- const TYPE_BOOL = 3;
+ const TYPE_BOOLEAN = 3;
/**
* Initialize a new DatabaseObject-related action.
* @param boolean $allowEmpty
* @param string $arrayIndex
*/
- protected function readBool($variableName, $allowEmpty = false, $arrayIndex = '') {
- $this->readValue($variableName, $allowEmpty, $arrayIndex, self::TYPE_BOOL);
+ protected function readBoolean($variableName, $allowEmpty = false, $arrayIndex = '') {
+ $this->readValue($variableName, $allowEmpty, $arrayIndex, self::TYPE_BOOLEAN);
}
/**
}
break;
- case self::TYPE_BOOL:
+ case self::TYPE_BOOLEAN:
if (!isset($target[$variableName])) {
if ($allowEmpty) {
$target[$variableName] = false;
}
}
else {
- if (is_string($target[$variableName])) {
- $target[$variableName] = $target[$variableName] != 'false';
+ if (is_numeric($target[$variableName])) {
+ $target[$variableName] = (bool) $target[$variableName];
}
else {
- $target[$variableName] = (bool) $target[$variableName];
+ $target[$variableName] = $target[$variableName] != 'false';
}
}
break;