PHP8 deprecated function warnings

Created on 20 April 2023, over 1 year ago

On the next page load after producing a pdf file via views I am getting the following 2 warnings (lots of them depending on the view results):

Deprecated function: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in PdfTemplate->renderItem() (line 514 of /.../modules/views_pdf/views_pdf_template.php).
Deprecated function: strip_tags(): Passing null to parameter #1 ($string) of type string is deprecated in PdfTemplate->renderItem() (line 628 of /.../modules/views_pdf/views_pdf_template.php).

Proposed resolution

The following modifications are fixing the issues.
Lines 514-515:

if (!empty($content)) {
      $content = str_replace('>', '>', $content);
      $content = str_replace('<', '<', $content);
}

Line 628:
$content = html_entity_decode(strip_tags((string)$content), ENT_QUOTES | ENT_HTML401);

🐛 Bug report
Status

Active

Version

3.1

Component

Code

Created by

🇬🇷Greece arx-e

Live updates comments and jobs are added and updated live.
  • PHP 8.1

    The issue particularly affects sites running on PHP version 8.1.0 or later.

Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024