- Issue created by @fromme
- Merge request !96Fix "Deprecated function: str_starts_with(): Passing null to parameter #1... → (Open) created by fromme
- Status changed to Needs review
9 months ago 11:27am 22 February 2024
The setting "offline_page" is optional and can be set empty:
And if so - in serviceWorkerRegistration()
the var $cacheUrls
will have array with one element some_key => null
, and next in fetchOfflinePageResources()
we will get "Deprecated function: str_starts_with(): Passing null to parameter #1 ($haystack) of type string is deprecated in Drupal\Core\Url::fromUserInput() (line 223 of core/lib/Drupal/Core/Url.php)."
Change:
$cacheUrls[] = $swConfig->get('offline_page');
To:
if (!empty($swConfig->get('offline_page')){
$cacheUrls[] = $swConfig->get('offline_page');
}
Needs review
2.1
pwa_service_worker