Skip to content

Undefined index: query (class-amp-youtube-embed.php in AMP_YouTube_Embed_Handler::get_video_id_from_url) #3348

@archon810

Description

@archon810

If YouTube is embedded in this format: https://www.youtube.com/embed/xS3yL5kR02 and not the usual ?v= method, the following notice will be triggered:

ErrorException: Notice: Undefined index: query
#12 /wp-content/plugins/amp/includes/embeds/class-amp-youtube-embed.php(166): AMP_YouTube_Embed_Handler::get_video_id_from_url
#11 /wp-content/plugins/amp/includes/embeds/class-amp-youtube-embed.php(84): AMP_YouTube_Embed_Handler::shortcode
#10 /wp-content/plugins/amp/includes/embeds/class-amp-youtube-embed.php(106): AMP_YouTube_Embed_Handler::oembed
#9 /wordpress/wp-includes/class-wp-embed.php(173): WP_Embed::shortcode
#8 /wordpress/wp-includes/class-wp-embed.php(427): WP_Embed::autoembed_callback
#7 [internal](0): preg_replace_callback
#6 /wordpress/wp-includes/class-wp-embed.php(409): WP_Embed::autoembed
#5 /wordpress/wp-includes/class-wp-hook.php(286): WP_Hook::apply_filters
#4 /wordpress/wp-includes/plugin.php(208): apply_filters
#3 /wp-content/themes/ap2/amp/single.php(12): include
#2 /wordpress/wp-includes/template-loader.php(78): require_once
#1 /wordpress/wp-blog-header.php(19): require
#0 /index.php(23): null

I'm using v1.2.2 of the AMP WP plugin.


Do not alter or remove anything below. The following sections will be managed by moderators only.

QA testing instructions

Embed the URL https://www.youtube.com/embed/5O-hLjRiBoY into a page. Visiting the AMP version of that page should not throw the error outlined above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't workingQA passedHas passed QA and is done

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions