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

escape match value for the query #1551

Merged
merged 1 commit into from
Nov 27, 2024
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
3 changes: 2 additions & 1 deletion src/fields/CalendarEvents.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use craft\feedme\base\FieldInterface;
use craft\feedme\helpers\DataHelper;
use craft\feedme\Plugin;
use craft\helpers\Db;
use craft\helpers\Json;
use Solspace\Calendar\Elements\Event as EventElement;

Expand Down Expand Up @@ -124,7 +125,7 @@ public function parseField(): mixed
$criteria['status'] = null;
$criteria['typeId'] = $typeIds;
$criteria['limit'] = $limit;
$criteria[$match] = $dataValue;
$criteria[$match] = Db::escapeParam($dataValue);

Craft::configure($query, $criteria);

Expand Down
2 changes: 1 addition & 1 deletion src/fields/Categories.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public function parseField(): mixed

$criteria['status'] = null;
$criteria['limit'] = $limit;
$criteria[$match] = $dataValue;
$criteria[$match] = Db::escapeParam($dataValue);

Craft::configure($query, $criteria);

Expand Down
2 changes: 1 addition & 1 deletion src/fields/CommerceProducts.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public function parseField(): mixed
$criteria['status'] = null;
$criteria['typeId'] = $typeIds;
$criteria['limit'] = $limit;
$criteria[$match] = $dataValue;
$criteria[$match] = Db::escapeParam($dataValue);

Craft::configure($query, $criteria);

Expand Down
3 changes: 2 additions & 1 deletion src/fields/CommerceVariants.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use craft\feedme\base\FieldInterface;
use craft\feedme\helpers\DataHelper;
use craft\feedme\Plugin;
use craft\helpers\Db;
use craft\helpers\Json;

/**
Expand Down Expand Up @@ -128,7 +129,7 @@ public function parseField(): mixed
$criteria['status'] = null;
$criteria['typeId'] = $typeIds;
$criteria['limit'] = $limit;
$criteria[$match] = $dataValue;
$criteria[$match] = Db::escapeParam($dataValue);

Craft::configure($query, $criteria);

Expand Down
3 changes: 2 additions & 1 deletion src/fields/DigitalProducts.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use craft\feedme\base\FieldInterface;
use craft\feedme\helpers\DataHelper;
use craft\feedme\Plugin;
use craft\helpers\Db;
use craft\helpers\Json;

/**
Expand Down Expand Up @@ -129,7 +130,7 @@ public function parseField(): mixed
$criteria['status'] = null;
$criteria['typeId'] = $typeIds;
$criteria['limit'] = $limit;
$criteria[$match] = $dataValue;
$criteria[$match] = Db::escapeParam($dataValue);

Craft::configure($query, $criteria);

Expand Down
2 changes: 1 addition & 1 deletion src/fields/Entries.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public function parseField(): mixed

$criteria['status'] = null;
$criteria['limit'] = $limit;
$criteria[$match] = $dataValue;
$criteria[$match] = Db::escapeParam($dataValue);

Craft::configure($query, $criteria);

Expand Down
2 changes: 1 addition & 1 deletion src/fields/Tags.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public function parseField(): mixed
$criteria['status'] = null;
$criteria['groupId'] = $groupId;
$criteria['limit'] = $limit;
$criteria[$match] = $dataValue;
$criteria[$match] = Db::escapeParam($dataValue);

Craft::configure($query, $criteria);

Expand Down
2 changes: 1 addition & 1 deletion src/fields/Users.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public function parseField(): mixed
$ids = [];
$criteria['status'] = null;
$criteria['limit'] = $limit;
$criteria[$match] = $dataValue;
$criteria[$match] = Db::escapeParam($dataValue);

// If the only source for the Users field is "admins" we don't have to bother with this query.
if (!($isAdmin && empty($groupIds) && empty($customSources))) {
Expand Down
Loading