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.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | pwa-3305141-php8-compatibility-valueerror_1.patch | 413 bytes | Dmitrii_Zadorozhnyi |
Issue fork pwa-3305141
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
Comment #2
Dmitrii_Zadorozhnyi commentedComment #3
Dmitrii_Zadorozhnyi commentedComment #4
Dmitrii_Zadorozhnyi commentedComment #5
anybodyThanks @Dmitrii_Zadorozhnyi! Could you please provide the patch as MR?
Comment #6
anybodyComment #7
anybodyComment #10
sidharth_soman commentedCreated an MR for the issue.
Comment #11
sano commentedWorks for me, thanks.
Comment #13
anybody