TypeError: Cannot access offset of type string on string

Created on 13 February 2023, almost 2 years ago

Hello everyone, I understand that this module is not really actively maintained but was hoping someone could help me. I have come across this error when switching to php 8.1. The filter works on shorter URLs (www.nypost.com) but fails and gives and error on longer URLs (www.nypost.com/2023/02/12/mount-sinai-merger-bid-to-free-up-prized-east-...)

The page returns an error:

TypeError: Cannot access offset of type string on string in opengraph_filter_find_tags() (line 77 of modules/contrib/opengraph_filter/opengraph_filter.module)

In code the snip from line 77 looks like this:

  if (gettype(@$these_tags[$key]) != 'NULL') {
              if (gettype(@$these_tags) == 'string') {
                $these_tags = [$keys[$j - 1] => $these_tags];
                $these_tags[$key] = $found[6][$i];
              }
	

I have applied the patches to the dev version. Any help or point in the right direction would be much appreciated.

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇦🇴Angola chipchenko

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

Comments & Activities

Production build 0.71.5 2024