Fix PDO inconsistent types handling

This commit is contained in:
Bartek Fabiszewski 2020-03-30 12:20:28 +02:00
parent 1255240e6d
commit 2f6603a18f
3 changed files with 13 additions and 13 deletions

View File

@ -427,18 +427,18 @@ require_once(ROOT_DIR . "/helpers/upload.php");
*/ */
private static function rowToObject($row) { private static function rowToObject($row) {
$position = new uPosition(); $position = new uPosition();
$position->id = $row['id']; $position->id = (int) $row['id'];
$position->timestamp = $row['tstamp']; $position->timestamp = (int) $row['tstamp'];
$position->userId = $row['user_id']; $position->userId = (int) $row['user_id'];
$position->userLogin = $row['login']; $position->userLogin = $row['login'];
$position->trackId = $row['track_id']; $position->trackId = (int) $row['track_id'];
$position->trackName = $row['name']; $position->trackName = $row['name'];
$position->latitude = $row['latitude']; $position->latitude = (double) $row['latitude'];
$position->longitude = $row['longitude']; $position->longitude = (double) $row['longitude'];
$position->altitude = $row['altitude']; $position->altitude = (double) $row['altitude'];
$position->speed = $row['speed']; $position->speed = (double) $row['speed'];
$position->bearing = $row['bearing']; $position->bearing = (double) $row['bearing'];
$position->accuracy = $row['accuracy']; $position->accuracy = (int) $row['accuracy'];
$position->provider = $row['provider']; $position->provider = $row['provider'];
$position->comment = $row['comment']; $position->comment = $row['comment'];
$position->image = $row['image']; $position->image = $row['image'];

View File

@ -234,8 +234,8 @@
*/ */
private static function rowToObject($row) { private static function rowToObject($row) {
$track = new uTrack(); $track = new uTrack();
$track->id = $row['id']; $track->id = (int) $row['id'];
$track->userId = $row['user_id']; $track->userId = (int) $row['user_id'];
$track->name = $row['name']; $track->name = $row['name'];
$track->comment = $row['comment']; $track->comment = $row['comment'];
$track->isValid = true; $track->isValid = true;

View File

@ -230,7 +230,7 @@
*/ */
private static function rowToObject($row) { private static function rowToObject($row) {
$user = new uUser(); $user = new uUser();
$user->id = $row['id']; $user->id = (int) $row['id'];
$user->login = $row['login']; $user->login = $row['login'];
$user->hash = $row['password']; $user->hash = $row['password'];
$user->isAdmin = (bool) $row['admin']; $user->isAdmin = (bool) $row['admin'];