Skip to content

Commit

Permalink
Array check
Browse files Browse the repository at this point in the history
  • Loading branch information
Simbiat committed Apr 3, 2021
1 parent 7e046e5 commit fef0ee8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Headers.php
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,10 @@ public function links(array $links = [], string $type = 'header', bool $strictRe
#Prepare an empty string
$linksToSend = [];
foreach ($links as $key=>$link) {
#Check that element is an array;
if (!is_array($link)) {
continue;
}
#Is Save-Data is set to 'on', disable (remove respective rel) HTTP2 push logic (that is preloads and prefetches)
if ($savedata === true && isset($link['rel'])) {
$link['rel'] = preg_replace('/(dns-prefetch|modulepreload|preconnect|prefetch|preload|prerender)/i', '', $link['rel']);
Expand Down

0 comments on commit fef0ee8

Please sign in to comment.