Commit b6e13be0 authored by Armando Lüscher's avatar Armando Lüscher Committed by GitHub

Merge pull request #520 from no-nevis/patch-1

Fix #518  - Properly saving Chat IDs
parents 80e7e5d5 63a31eaf
...@@ -12,6 +12,8 @@ Exclamation symbols (:exclamation:) note something of importance e.g. breaking c ...@@ -12,6 +12,8 @@ Exclamation symbols (:exclamation:) note something of importance e.g. breaking c
### Removed ### Removed
- [:exclamation:][unreleased-bc-up-download-directory] Upload and download directories are not set any more by default and must be set manually. - [:exclamation:][unreleased-bc-up-download-directory] Upload and download directories are not set any more by default and must be set manually.
### Fixed ### Fixed
- ID fields are now typed with `PARAM_STR` PDO data type, to allow huge numbers.
- Message type data type for PDO corrected.
### Security ### Security
## [0.44.1] - 2017-04-25 ## [0.44.1] - 2017-04-25
......
...@@ -201,7 +201,7 @@ class DB ...@@ -201,7 +201,7 @@ class DB
$sth->bindParam(':limit', $limit, PDO::PARAM_INT); $sth->bindParam(':limit', $limit, PDO::PARAM_INT);
if ($id !== null) { if ($id !== null) {
$sth->bindParam(':id', $id, PDO::PARAM_INT); $sth->bindParam(':id', $id, PDO::PARAM_STR);
} }
$sth->execute(); $sth->execute();
...@@ -327,13 +327,13 @@ class DB ...@@ -327,13 +327,13 @@ class DB
(:id, :chat_id, :message_id, :inline_query_id, :chosen_inline_result_id, :callback_query_id, :edited_message_id) (:id, :chat_id, :message_id, :inline_query_id, :chosen_inline_result_id, :callback_query_id, :edited_message_id)
'); ');
$sth->bindParam(':id', $id, PDO::PARAM_INT); $sth->bindParam(':id', $id, PDO::PARAM_STR);
$sth->bindParam(':chat_id', $chat_id, PDO::PARAM_INT); $sth->bindParam(':chat_id', $chat_id, PDO::PARAM_STR);
$sth->bindParam(':message_id', $message_id, PDO::PARAM_INT); $sth->bindParam(':message_id', $message_id, PDO::PARAM_STR);
$sth->bindParam(':inline_query_id', $inline_query_id, PDO::PARAM_INT); $sth->bindParam(':inline_query_id', $inline_query_id, PDO::PARAM_STR);
$sth->bindParam(':chosen_inline_result_id', $chosen_inline_result_id, PDO::PARAM_INT); $sth->bindParam(':chosen_inline_result_id', $chosen_inline_result_id, PDO::PARAM_STR);
$sth->bindParam(':callback_query_id', $callback_query_id, PDO::PARAM_INT); $sth->bindParam(':callback_query_id', $callback_query_id, PDO::PARAM_STR);
$sth->bindParam(':edited_message_id', $edited_message_id, PDO::PARAM_INT); $sth->bindParam(':edited_message_id', $edited_message_id, PDO::PARAM_STR);
return $sth->execute(); return $sth->execute();
} catch (PDOException $e) { } catch (PDOException $e) {
...@@ -375,7 +375,7 @@ class DB ...@@ -375,7 +375,7 @@ class DB
`updated_at` = VALUES(`updated_at`) `updated_at` = VALUES(`updated_at`)
'); ');
$sth->bindParam(':id', $user_id, PDO::PARAM_INT); $sth->bindParam(':id', $user_id, PDO::PARAM_STR);
$sth->bindParam(':username', $username, PDO::PARAM_STR, 255); $sth->bindParam(':username', $username, PDO::PARAM_STR, 255);
$sth->bindParam(':first_name', $first_name, PDO::PARAM_STR, 255); $sth->bindParam(':first_name', $first_name, PDO::PARAM_STR, 255);
$sth->bindParam(':last_name', $last_name, PDO::PARAM_STR, 255); $sth->bindParam(':last_name', $last_name, PDO::PARAM_STR, 255);
...@@ -398,8 +398,8 @@ class DB ...@@ -398,8 +398,8 @@ class DB
(:user_id, :chat_id) (:user_id, :chat_id)
'); ');
$sth->bindParam(':user_id', $user_id, PDO::PARAM_INT); $sth->bindParam(':user_id', $user_id, PDO::PARAM_STR);
$sth->bindParam(':chat_id', $chat_id, PDO::PARAM_INT); $sth->bindParam(':chat_id', $chat_id, PDO::PARAM_STR);
$status = $sth->execute(); $status = $sth->execute();
} catch (PDOException $e) { } catch (PDOException $e) {
...@@ -449,14 +449,14 @@ class DB ...@@ -449,14 +449,14 @@ class DB
if ($migrate_to_chat_id) { if ($migrate_to_chat_id) {
$chat_type = 'supergroup'; $chat_type = 'supergroup';
$sth->bindParam(':id', $migrate_to_chat_id, PDO::PARAM_INT); $sth->bindParam(':id', $migrate_to_chat_id, PDO::PARAM_STR);
$sth->bindParam(':oldid', $chat_id, PDO::PARAM_INT); $sth->bindParam(':oldid', $chat_id, PDO::PARAM_STR);
} else { } else {
$sth->bindParam(':id', $chat_id, PDO::PARAM_INT); $sth->bindParam(':id', $chat_id, PDO::PARAM_STR);
$sth->bindParam(':oldid', $migrate_to_chat_id, PDO::PARAM_INT); $sth->bindParam(':oldid', $migrate_to_chat_id, PDO::PARAM_STR);
} }
$sth->bindParam(':type', $chat_type, PDO::PARAM_INT); $sth->bindParam(':type', $chat_type, PDO::PARAM_STR);
$sth->bindParam(':title', $chat_title, PDO::PARAM_STR, 255); $sth->bindParam(':title', $chat_title, PDO::PARAM_STR, 255);
$sth->bindParam(':username', $chat_username, PDO::PARAM_STR, 255); $sth->bindParam(':username', $chat_username, PDO::PARAM_STR, 255);
$sth->bindParam(':all_members_are_administrators', $chat_all_members_are_administrators, PDO::PARAM_INT); $sth->bindParam(':all_members_are_administrators', $chat_all_members_are_administrators, PDO::PARAM_INT);
...@@ -616,8 +616,8 @@ class DB ...@@ -616,8 +616,8 @@ class DB
$query = $inline_query->getQuery(); $query = $inline_query->getQuery();
$offset = $inline_query->getOffset(); $offset = $inline_query->getOffset();
$sth->bindParam(':inline_query_id', $inline_query_id, PDO::PARAM_INT); $sth->bindParam(':inline_query_id', $inline_query_id, PDO::PARAM_STR);
$sth->bindParam(':user_id', $user_id, PDO::PARAM_INT); $sth->bindParam(':user_id', $user_id, PDO::PARAM_STR);
$sth->bindParam(':location', $location, PDO::PARAM_STR); $sth->bindParam(':location', $location, PDO::PARAM_STR);
$sth->bindParam(':query', $query, PDO::PARAM_STR); $sth->bindParam(':query', $query, PDO::PARAM_STR);
$sth->bindParam(':param_offset', $offset, PDO::PARAM_STR); $sth->bindParam(':param_offset', $offset, PDO::PARAM_STR);
...@@ -665,7 +665,7 @@ class DB ...@@ -665,7 +665,7 @@ class DB
$query = $chosen_inline_result->getQuery(); $query = $chosen_inline_result->getQuery();
$sth->bindParam(':result_id', $result_id, PDO::PARAM_STR); $sth->bindParam(':result_id', $result_id, PDO::PARAM_STR);
$sth->bindParam(':user_id', $user_id, PDO::PARAM_INT); $sth->bindParam(':user_id', $user_id, PDO::PARAM_STR);
$sth->bindParam(':location', $location, PDO::PARAM_STR); $sth->bindParam(':location', $location, PDO::PARAM_STR);
$sth->bindParam(':inline_message_id', $inline_message_id, PDO::PARAM_STR); $sth->bindParam(':inline_message_id', $inline_message_id, PDO::PARAM_STR);
$sth->bindParam(':query', $query, PDO::PARAM_STR); $sth->bindParam(':query', $query, PDO::PARAM_STR);
...@@ -733,10 +733,10 @@ class DB ...@@ -733,10 +733,10 @@ class DB
$inline_message_id = $callback_query->getInlineMessageId(); $inline_message_id = $callback_query->getInlineMessageId();
$data = $callback_query->getData(); $data = $callback_query->getData();
$sth->bindParam(':callback_query_id', $callback_query_id, PDO::PARAM_INT); $sth->bindParam(':callback_query_id', $callback_query_id, PDO::PARAM_STR);
$sth->bindParam(':user_id', $user_id, PDO::PARAM_INT); $sth->bindParam(':user_id', $user_id, PDO::PARAM_STR);
$sth->bindParam(':chat_id', $chat_id, PDO::PARAM_INT); $sth->bindParam(':chat_id', $chat_id, PDO::PARAM_STR);
$sth->bindParam(':message_id', $message_id, PDO::PARAM_INT); $sth->bindParam(':message_id', $message_id, PDO::PARAM_STR);
$sth->bindParam(':inline_message_id', $inline_message_id, PDO::PARAM_STR); $sth->bindParam(':inline_message_id', $inline_message_id, PDO::PARAM_STR);
$sth->bindParam(':data', $data, PDO::PARAM_STR); $sth->bindParam(':data', $data, PDO::PARAM_STR);
$sth->bindParam(':created_at', $date, PDO::PARAM_STR); $sth->bindParam(':created_at', $date, PDO::PARAM_STR);
...@@ -868,13 +868,13 @@ class DB ...@@ -868,13 +868,13 @@ class DB
$migrate_to_chat_id = $message->getMigrateToChatId(); $migrate_to_chat_id = $message->getMigrateToChatId();
$pinned_message = $message->getPinnedMessage(); $pinned_message = $message->getPinnedMessage();
$sth->bindParam(':chat_id', $chat_id, PDO::PARAM_INT); $sth->bindParam(':chat_id', $chat_id, PDO::PARAM_STR);
$sth->bindParam(':message_id', $message_id, PDO::PARAM_INT); $sth->bindParam(':message_id', $message_id, PDO::PARAM_STR);
$sth->bindParam(':user_id', $from_id, PDO::PARAM_INT); $sth->bindParam(':user_id', $from_id, PDO::PARAM_STR);
$sth->bindParam(':date', $date, PDO::PARAM_STR); $sth->bindParam(':date', $date, PDO::PARAM_STR);
$sth->bindParam(':forward_from', $forward_from, PDO::PARAM_INT); $sth->bindParam(':forward_from', $forward_from, PDO::PARAM_STR);
$sth->bindParam(':forward_from_chat', $forward_from_chat, PDO::PARAM_INT); $sth->bindParam(':forward_from_chat', $forward_from_chat, PDO::PARAM_STR);
$sth->bindParam(':forward_from_message_id', $forward_from_message_id, PDO::PARAM_INT); $sth->bindParam(':forward_from_message_id', $forward_from_message_id, PDO::PARAM_STR);
$sth->bindParam(':forward_date', $forward_date, PDO::PARAM_STR); $sth->bindParam(':forward_date', $forward_date, PDO::PARAM_STR);
$reply_to_chat_id = null; $reply_to_chat_id = null;
...@@ -882,8 +882,8 @@ class DB ...@@ -882,8 +882,8 @@ class DB
$reply_to_chat_id = $chat_id; $reply_to_chat_id = $chat_id;
} }
$sth->bindParam(':reply_to_chat', $reply_to_chat_id, PDO::PARAM_INT); $sth->bindParam(':reply_to_chat', $reply_to_chat_id, PDO::PARAM_STR);
$sth->bindParam(':reply_to_message', $reply_to_message_id, PDO::PARAM_INT); $sth->bindParam(':reply_to_message', $reply_to_message_id, PDO::PARAM_STR);
$sth->bindParam(':text', $text, PDO::PARAM_STR); $sth->bindParam(':text', $text, PDO::PARAM_STR);
$sth->bindParam(':entities', $entities, PDO::PARAM_STR); $sth->bindParam(':entities', $entities, PDO::PARAM_STR);
$sth->bindParam(':audio', $audio, PDO::PARAM_STR); $sth->bindParam(':audio', $audio, PDO::PARAM_STR);
...@@ -896,16 +896,16 @@ class DB ...@@ -896,16 +896,16 @@ class DB
$sth->bindParam(':contact', $contact, PDO::PARAM_STR); $sth->bindParam(':contact', $contact, PDO::PARAM_STR);
$sth->bindParam(':location', $location, PDO::PARAM_STR); $sth->bindParam(':location', $location, PDO::PARAM_STR);
$sth->bindParam(':venue', $venue, PDO::PARAM_STR); $sth->bindParam(':venue', $venue, PDO::PARAM_STR);
$sth->bindParam(':new_chat_member', $new_chat_member, PDO::PARAM_INT); $sth->bindParam(':new_chat_member', $new_chat_member, PDO::PARAM_STR);
$sth->bindParam(':left_chat_member', $left_chat_member, PDO::PARAM_INT); $sth->bindParam(':left_chat_member', $left_chat_member, PDO::PARAM_STR);
$sth->bindParam(':new_chat_title', $new_chat_title, PDO::PARAM_STR); $sth->bindParam(':new_chat_title', $new_chat_title, PDO::PARAM_STR);
$sth->bindParam(':new_chat_photo', $new_chat_photo, PDO::PARAM_STR); $sth->bindParam(':new_chat_photo', $new_chat_photo, PDO::PARAM_STR);
$sth->bindParam(':delete_chat_photo', $delete_chat_photo, PDO::PARAM_INT); $sth->bindParam(':delete_chat_photo', $delete_chat_photo, PDO::PARAM_INT);
$sth->bindParam(':group_chat_created', $group_chat_created, PDO::PARAM_INT); $sth->bindParam(':group_chat_created', $group_chat_created, PDO::PARAM_INT);
$sth->bindParam(':supergroup_chat_created', $supergroup_chat_created, PDO::PARAM_INT); $sth->bindParam(':supergroup_chat_created', $supergroup_chat_created, PDO::PARAM_INT);
$sth->bindParam(':channel_chat_created', $channel_chat_created, PDO::PARAM_INT); $sth->bindParam(':channel_chat_created', $channel_chat_created, PDO::PARAM_INT);
$sth->bindParam(':migrate_from_chat_id', $migrate_from_chat_id, PDO::PARAM_INT); $sth->bindParam(':migrate_from_chat_id', $migrate_from_chat_id, PDO::PARAM_STR);
$sth->bindParam(':migrate_to_chat_id', $migrate_to_chat_id, PDO::PARAM_INT); $sth->bindParam(':migrate_to_chat_id', $migrate_to_chat_id, PDO::PARAM_STR);
$sth->bindParam(':pinned_message', $pinned_message, PDO::PARAM_STR); $sth->bindParam(':pinned_message', $pinned_message, PDO::PARAM_STR);
return $sth->execute(); return $sth->execute();
...@@ -964,9 +964,9 @@ class DB ...@@ -964,9 +964,9 @@ class DB
$text = $edited_message->getText(); $text = $edited_message->getText();
$caption = $edited_message->getCaption(); $caption = $edited_message->getCaption();
$sth->bindParam(':chat_id', $chat_id, PDO::PARAM_INT); $sth->bindParam(':chat_id', $chat_id, PDO::PARAM_STR);
$sth->bindParam(':message_id', $message_id, PDO::PARAM_INT); $sth->bindParam(':message_id', $message_id, PDO::PARAM_STR);
$sth->bindParam(':user_id', $from_id, PDO::PARAM_INT); $sth->bindParam(':user_id', $from_id, PDO::PARAM_STR);
$sth->bindParam(':edit_date', $edit_date, PDO::PARAM_STR); $sth->bindParam(':edit_date', $edit_date, PDO::PARAM_STR);
$sth->bindParam(':text', $text, PDO::PARAM_STR); $sth->bindParam(':text', $text, PDO::PARAM_STR);
$sth->bindParam(':entities', $entities, PDO::PARAM_STR); $sth->bindParam(':entities', $entities, PDO::PARAM_STR);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment