[wp-trac] [WordPress Trac] #65068: PHP warnings when a registered oEmbed provider is malformed
WordPress Trac
noreply at wordpress.org
Mon Apr 13 21:22:14 UTC 2026
#65068: PHP warnings when a registered oEmbed provider is malformed
--------------------------+-----------------------------
Reporter: bradshawtm | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Embeds | Version:
Severity: minor | Keywords:
Focuses: |
--------------------------+-----------------------------
There's no gate to ensure oEmbed providers are valid, so when they're not,
one gets these warnings:
{{{
PHP Warning: Undefined array key 0 in /var/www/html/wp-includes/class-wp-
oembed.php on line 276
PHP Warning: Undefined array key 1 in /var/www/html/wp-includes/class-wp-
oembed.php on line 276
}}}
To reproduce:
First, add an `mu-plugin` (this same errant structure was seen in the
wild):
{{{
<?php
add_filter(
'oembed_providers',
function ( $providers ) {
$providers['bad_provider'] = array(
'url' => '#https?://example\.site/.*#i',
'endpoint' => 'https://example.site/api/oembed',
);
return $providers;
}
);
}}}
1. Go to a new post page.
2. Paste a URL that doesn't have an oEmbed, e.g.
`https://en.wikipedia.org/wiki/Rickrolling`
3. Do NOT click "Convert to link".
4. Refresh the post.
Each refresh will show the set of warnings.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/65068>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list