Must be of type string, array given in strpos()

Created on 25 February 2023, over 1 year ago
Updated 12 May 2023, over 1 year ago

Problem/Motivation

I am getting an error on some pages after upgrading to php8 because $this->data['value'] ends up being an array and strpos expects a string.

TypeError: strpos(): Argument #1 ($haystack) must be of type string, array given in strpos()
line 540 of .../sites/all/modules/contrib/metatag/metatag.inc

Steps to reproduce

It only happens on some pages in my site and I son't have a full understanding why.

Proposed resolution

It can be solved by adding another condition on $this->data['value']
!is_string($this->data['value'])

Patch coming

πŸ› Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡¨πŸ‡¦Canada circuscowboy

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