More defensive checks for date_epoch data type.
This commit is contained in:
parent
8c148e7e4b
commit
d2e6689407
|
@ -751,8 +751,15 @@ WHERE $where_clause
|
||||||
$row[ $destination_alias ] = wc_string_to_bool( $row[ $destination_alias ] );
|
$row[ $destination_alias ] = wc_string_to_bool( $row[ $destination_alias ] );
|
||||||
}
|
}
|
||||||
if ( 'date_epoch' === $schema['type'] ) {
|
if ( 'date_epoch' === $schema['type'] ) {
|
||||||
|
if ( '' === $row[ $alias ] || null === $row[ $alias ] ) {
|
||||||
|
$row[ $alias ] = null;
|
||||||
|
} else {
|
||||||
$row[ $alias ] = ( new \DateTime( "@{$row[ $alias ]}" ) )->format( 'Y-m-d H:i:s' );
|
$row[ $alias ] = ( new \DateTime( "@{$row[ $alias ]}" ) )->format( 'Y-m-d H:i:s' );
|
||||||
}
|
}
|
||||||
|
if ( '0000-00-00 00:00:00' === $row[ $destination_alias ] ) {
|
||||||
|
$row[ $destination_alias ] = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
if ( is_null( $row[ $alias ] ) ) {
|
if ( is_null( $row[ $alias ] ) ) {
|
||||||
$row[ $alias ] = $this->get_type_defaults( $schema['type'] );
|
$row[ $alias ] = $this->get_type_defaults( $schema['type'] );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue