mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-18 18:46:17 +00:00
Checking for null values before converting to boolean
This commit is contained in:
parent
de6eda964e
commit
665e560310
3 changed files with 3 additions and 3 deletions
|
@ -238,7 +238,7 @@ class DboMysql extends DboSource {
|
|||
foreach ($this->map as $col => $meta) {
|
||||
list($table, $column, $type) = $meta;
|
||||
$resultRow[$table][$column] = $row[$col];
|
||||
if ($type == 'boolean') {
|
||||
if ($type == 'boolean' && !is_null($row[$col])) {
|
||||
$resultRow[$table][$column] = $this->boolean($resultRow[$table][$column]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -707,7 +707,7 @@ class DboPostgres extends DboSource {
|
|||
|
||||
switch ($type) {
|
||||
case 'bool':
|
||||
$resultRow[$table][$column] = $this->boolean($row[$index]);
|
||||
$resultRow[$table][$column] = is_null($row[$index]) ? null : $this->boolean($row[$index]);
|
||||
break;
|
||||
case 'binary':
|
||||
case 'bytea':
|
||||
|
|
|
@ -336,7 +336,7 @@ class DboSqlite extends DboSource {
|
|||
foreach ($this->map as $col => $meta) {
|
||||
list($table, $column, $tpye) = $meta;
|
||||
$resultRow[$table][$column] = $row[$col];
|
||||
if ($type === 'boolean') {
|
||||
if ($type == 'boolean' && !is_null($row[$col])) {
|
||||
$resultRow[$table][$column] = $this->boolean($resultRow[$table][$column]);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue