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

Created on 12 February 2021, over 3 years ago
Updated 27 July 2023, about 1 year ago

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).

🐛 Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

🇧🇾Belarus Andrei Haurukovich Minsk

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024