Skip to content
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
7 changes: 6 additions & 1 deletion src/Admin/OptionsManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,13 @@ public function configuredPlatformNames(): array
* @param array<string, mixed> $input
* @return array<string, mixed>
*/
public function sanitize(array $input): array
public function sanitize(mixed $input): array
{
// WordPress passes $_POST data directly; guard against non-array input.
if (! is_array($input)) {
return $this->all();
}

$existing = $this->all();
$sanitized = [
'platforms' => $existing['platforms'] ?? [],
Expand Down
2 changes: 2 additions & 0 deletions src/Admin/SettingsPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,8 @@ public function registerSettings(): void
'owlstack_settings',
[
'type' => 'array',
// Custom callback needed for array-type settings.
// All keys sanitized via sanitize_key(), all values via sanitize_text_field().
'sanitize_callback' => [$this->optionsManager, 'sanitize'],
],
);
Expand Down
Loading