preg_quote() expects parameter 1 to be string in oembed/src/Provider/ConfigEntityProvider.php

Created on 9 November 2016, almost 8 years ago
Updated 20 August 2024, about 2 months ago

The error message:

Warning: preg_quote() expects parameter 1 to be string, array given in Drupal\oembed\Provider\ConfigEntityProvider::Drupal\oembed\Provider\{closure}() (line 98 of modules/contrib/oembed/src/Provider/ConfigEntityProvider.php).

The following lines of code somehow end up with the value of $scheme that is not a string.

  private static function schemeToRegex($schemes, $capture_subpatterns = FALSE) {
    $patterns = array_map(function ($scheme) use ($capture_subpatterns) {
      return str_replace('\*', $capture_subpatterns ? '(.*)' : '.*', preg_quote($scheme, '#'));
    }, $schemes);

    return '#'. implode('|', $patterns) .'#i';
  }

it seems like the expected structure is that $schemes is an array of strings, but for some reason it contains an array of arrays.

πŸ› Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡ͺπŸ‡¨Ecuador jwilson3

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

Merge Requests

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