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.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | preg-quote-error-2826119-5.patch | 3.36 KB | marthinal |
Issue fork oembed-2826119
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
jwilson3Comment #3
jwilson3It seems like array_map expects the use parameter to be an array, but
$capture_subpatternsis a boolean, this might be part of the problem.Comment #4
jwilson3Hrm. nevermind the above. I get how "use" works now, but It seems like the expected structure is that $schemes is an array of strings, but for some reason it contains an array of arrays.
Comment #5
marthinal commented$schemes is an array of arrays. I've created patch where we use all the regex to verify if the url is supported and obtain the provider name. We can refactor and improve but anyway we need to fix this problem because the current method schemeToRegex() is not working as expected.
Comment #9
astonvictor commentedthanks for the patch.
merged and fixed.