Problem/Motivation

After switch to php7.4 I catched some errors

Notice: Trying to access array offset on value of type null in amp_node_view() (line 673 of ../contrib/amp/amp.module). request_id="v-77a60632-686d-11eb-bb4b-ff0915a6cda2"
Notice: Trying to access array offset on value of type null in amp_node_view() (line 676 of ../amp/amp.module). request_id="v-77a60632-686d-11eb-bb4b-ff0915a6cda2"
Notice: Trying to access array offset on value of type null in amp_node_view()

Steps to reproduce

1. Enable php7.4
2. Go to some amp page
3. Check logs

Proposed resolution

I would suggest to apply a patch

Patch update for fixing PHP8.1 deprecations:

Deprecated function: strip_tags(): Passing null to parameter #1 ($string) of type string is deprecated in amp_node_view() (line 692 of modules/contrib/amp/amp.module).
Deprecated function: substr(): Passing null to parameter #1 ($string) of type string is deprecated in amp_node_view() (line 710 of modules/contrib/amp/amp.module).
Deprecated function: strip_tags(): Passing null to parameter #1 ($string) of type string is deprecated in {closure}() (line 758 of
modules/contrib/amp/amp.module).

Comments

Andrei Haurukovich created an issue. See original summary.

Andrei Haurukovich’s picture

StatusFileSize
new1.55 KB
Andrei Haurukovich’s picture

Status: Active » Needs review
Natallia’s picture

Issue summary: View changes
StatusFileSize
new2.09 KB

Patch update for fixing PHP8.1 deprecations

Natallia’s picture

Issue summary: View changes
Andrei Haurukovich’s picture

Title: Notice: Trying to access array offset on value of type null on php 7.4 » Notice: Trying to access array offset on value of type null on php 7.4 and php8.1
alena_stanul’s picture

Title: Notice: Trying to access array offset on value of type null on php 7.4 and php8.1 » Edit Notice: Trying to access array offset on value of type null on php 7.4 and php8.1

These types of warnings are considered in PHP 8.1 warnings. Passing null to parameter of type string is deprecated issue.