Problem/Motivation

In pwa.module in implementation of hook_flush_caches cache_set used to set data from _pwa_serviceworker_file. In _pwa_fetch_offline_page_resources function if drupal_http_request return empty data this can cause an error "ValueError: DOMDocument::loadHTML(): Argument #1 ($source) must not be empty in DOMDocument->loadHTML()" after switching to PHP8 and trying to clear cache in pwa.module, line 250
According to https://www.php.net/manual/en/language.operators.errorcontrol.php:

"Prior to PHP 8.0.0, the error_reporting() called inside the custom error handler always returned 0 if the error was suppressed by the @ operator.
As of PHP 8.0.0, it returns the value E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR | E_RECOVERABLE_ERROR | E_PARSE."

and

"Prior to PHP 8.0.0, it was possible for the @ operator to disable critical errors that will terminate script execution. For example, prepending @ to a call of a function which did not exist, by being unavailable or mistyped, would cause the script to terminate with no indication as to why."

there is a need to add additional check for $response->data.

Issue fork pwa-3305141

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Dmitrii_Zadorozhnyi created an issue. See original summary.

Dmitrii_Zadorozhnyi’s picture

Issue summary: View changes
Dmitrii_Zadorozhnyi’s picture

Dmitrii_Zadorozhnyi’s picture

StatusFileSize
new413 bytes
anybody’s picture

Status: Needs review » Needs work

Thanks @Dmitrii_Zadorozhnyi! Could you please provide the patch as MR?

anybody’s picture

Priority: Normal » Major
anybody’s picture

Issue tags: +Novice

sidharth_soman made their first commit to this issue’s fork.

sidharth_soman’s picture

Status: Needs work » Needs review

Created an MR for the issue.

sano’s picture

Works for me, thanks.

anybody’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.