Skip to content

Commit

Permalink
fix: ensure backward compatibility for array spread operator
Browse files Browse the repository at this point in the history
  • Loading branch information
bepsvpt committed Oct 13, 2024
1 parent a55f7e5 commit 5d6e56c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Builders/ContentSecurityPolicyBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -250,12 +250,12 @@ protected function trustedTypes(): string
return '';
}

$policies = ['trusted-types'];

if ($trustedTypes['none'] ?? false) {
$policies[] = "'none'";
$policies = ['trusted-types', "'none'"];
} else {
array_push($policies, ...array_map('trim', $trustedTypes['policies'] ?? []));
$policies = array_map('trim', $trustedTypes['policies'] ?? []);

array_unshift($policies, 'trusted-types');

if ($trustedTypes['allow-duplicates'] ?? false) {
$policies[] = "'allow-duplicates'";
Expand Down

0 comments on commit 5d6e56c

Please sign in to comment.