Skip to content

Commit a0a90f8

Browse files
committed
Ensure old pattern ids are ints.
1 parent 8b55775 commit a0a90f8

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

server/actions/patterns/multiFavorite.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,19 @@ class multiFavorite extends \core\AbstractAction {
2525

2626
public function execute() {
2727
$urlIds = $this->getValue("patternIds");
28-
$userProfile = $this->getUserProfile();
2928

30-
$idList = quoteStringArray($urlIds);
29+
// Each id needs to be a number.
30+
$idList = quoteStringArray(array_map(function($id) {
31+
return intval($id);
32+
}, $urlIds));
3133

3234
$existingIds = $this->db->query("SELECT id FROM patterns WHERE id IN ($idList)");
3335
$cleanIds = [];
3436

3537
if (!is_null($existingIds)) {
3638
$idList = [];
39+
$userProfile = $this->getUserProfile();
40+
3741
for ($i=0; $i < count($existingIds); $i++) {
3842
$id = $existingIds[$i]->id;
3943
$cleanIds[] = convertToURL($id);

0 commit comments

Comments
 (0)