Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some PM bugs #7947

Merged
merged 5 commits into from
Dec 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions Sources/PersonalMessage/PM.php
Original file line number Diff line number Diff line change
Expand Up @@ -531,9 +531,8 @@ public static function get($ids, array $query_customizations = [])
$limit = $query_customizations['limit'] ?? count($ids);
$params = $query_customizations['params'] ?? [];

if (!empty($ids)) {
$params['ids'] = array_filter(array_unique(array_map('intval', $ids)));
}
// There will never be an ID 0, but SMF doesn't like empty arrays when you tell it to expect an array of integers...
$params['ids'] = empty($ids) ? [0] : array_filter(array_unique(array_map('intval', $ids)));

foreach(self::queryData($selects, $params, $joins, $where, $order, $group, $limit) as $row) {
$id = (int) $row['id_pm'];
Expand Down
2 changes: 1 addition & 1 deletion Sources/PersonalMessage/Popup.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function show(): void
}

// Now, actually fetch me some PMs.
foreach (PM::load($pms, false) as $pm) {
foreach (PM::load($pms) as $pm) {
// Make sure we track the senders. We have some work to do for them.
if (!empty($pm->member_from)) {
$senders[] = $pm->member_from;
Expand Down
2 changes: 2 additions & 0 deletions Sources/PersonalMessage/Received.php
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,8 @@ public static function getRecent(int $label = -1, string $sort = 'pmr.id_pm', bo
return self::$recent[$paramskey];
}

self::$recent[$paramskey] = [];

$joins = [];

$where = [
Expand Down
2 changes: 1 addition & 1 deletion Sources/PersonalMessage/Search.php
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ public function performSearch(): void
// Sort out the page index.
Utils::$context['page_index'] = new PageIndex(
Config::$scripturl . '?action=pm;sa=search2;params=' . $this->compressed_params,
$_GET['start'],
(int) ($_GET['start'] ?? 0),
Utils::$context['num_results'],
$this->per_page,
false,
Expand Down
Loading