Skip to content

Commit 27afbfd

Browse files
committed
prevent double encoding on save
1 parent 5a2eeb5 commit 27afbfd

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

modules/registrars/openprovider/Controllers/System/DnsManagementPageController.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,10 @@ public function show($params)
8989
}
9090

9191
try {
92-
$hostname = trim((string)($_POST['hostname'] ?? '')); // "www" or ""
93-
$type = strtoupper(trim((string)($_POST['type'] ?? '')));
94-
$address = trim((string)($_POST['address'] ?? ''));
95-
$priority = trim((string)($_POST['priority'] ?? ''));
92+
$hostname = html_entity_decode(trim((string) ($_POST['hostname'] ?? '')), ENT_QUOTES, 'UTF-8');
93+
$type = strtoupper(trim((string) ($_POST['type'] ?? '')));
94+
$address = html_entity_decode(trim((string) ($_POST['address'] ?? '')), ENT_QUOTES, 'UTF-8');
95+
$priority = html_entity_decode(trim((string) ($_POST['priority'] ?? '')), ENT_QUOTES, 'UTF-8');
9696

9797
if ($type === '' || $address === '') {
9898
http_response_code(400);
@@ -300,10 +300,10 @@ private function buildDnsRecordsFromPost(): array
300300
$priority = $_POST['dnsrecordpriority'] ?? [];
301301

302302
foreach ($hosts as $i => $host) {
303-
$host = trim((string)$host);
304-
$type = strtoupper(trim((string)($types[$i] ?? '')));
305-
$address = trim((string)($addresses[$i] ?? ''));
306-
$prio = trim((string)($priority[$i] ?? ''));
303+
$host = html_entity_decode(trim((string) $host), ENT_QUOTES, 'UTF-8');
304+
$type = strtoupper(trim((string) ($types[$i] ?? '')));
305+
$address = html_entity_decode(trim((string) ($addresses[$i] ?? '')), ENT_QUOTES, 'UTF-8');
306+
$prio = html_entity_decode(trim((string) ($priority[$i] ?? '')), ENT_QUOTES, 'UTF-8');
307307

308308
// Skip completely empty rows
309309
if ($host === '' && $address === '') {

0 commit comments

Comments
 (0)