Automattic / jetpack

Security, performance, marketing, and design tools — Jetpack is made by WordPress experts to make WP sites safer and faster, and help you grow your traffic.
https://jetpack.com/
Other
1.59k stars 799 forks source link

Shortcodes: PHP notices when using the Youtube Embed plugin #4612

Open Marian-Kechlibar opened 8 years ago

Marian-Kechlibar commented 8 years ago

Self-installed Wordpress 4.5.3 with the latest Jetpack, and the following plugin: https://wordpress.org/plugins/youtube-embed/

Steps to reproduce the issue

  1. Create a new post including a video, inserted following this format: youtube]HbWrJWWn9nU[/youtube]
  2. Load that post with WP_DEBUG set to true.
  3. A long list of errors regarding undefined index is seen at the top of the page: Notice: Undefined index: id in /var/www/kechlibar.net/wordpress/wp-content/plugins/jetpack/_inc/lib/class.media-summary.php on line 77

Notice: Undefined index: id in /var/www/kechlibar.net/wordpress/wp-content/plugins/jetpack/_inc/lib/class.media-summary.php on line 78

Notice: Undefined index: id in /var/www/kechlibar.net/wordpress/wp-content/plugins/jetpack/_inc/lib/class.media-summary.php on line 77

Notice: Undefined index: id in /var/www/kechlibar.net/wordpress/wp-content/plugins/jetpack/_inc/lib/class.media-summary.php on line 78

Notice: Undefined index: id in /var/www/kechlibar.net/wordpress/wp-content/plugins/jetpack/_inc/lib/class.media-summary.php on line 77

Notice: Undefined index: id in /var/www/kechlibar.net/wordpress/wp-content/plugins/jetpack/_inc/lib/class.media-summary.php on line 78

Notice: Undefined index: id in /var/www/kechlibar.net/wordpress/wp-content/plugins/jetpack/_inc/lib/class.media-summary.php on line 77

Notice: Undefined index: id in /var/www/kechlibar.net/wordpress/wp-content/plugins/jetpack/_inc/lib/class.media-summary.php on line 78

What I expected

I did not expect to see that for sure :-) The older articles, which were written before installing Jetpack, do not suffer from this problém.

Marian-Kechlibar commented 8 years ago

This is how it looks like.

I suppressed the error by editing php.ini, wp-config.php, .htaccess. Set everywhere debug flags to false etc. This helped. As this is a production site, I need it to look OK for visitors - cannot do many debugging experiments on the live system.

undefined_index

jeherve commented 8 years ago

Could you let me know if you have any videos in one or more posts displayed on your home page? If so, how did you insert those videos in your posts? Did you paste the video URL on its own line, or use any kind of shortcode / embed code?

Could you also let me know if you use any video management, or media embedding management plugins on that site?

Thanks!

Marian-Kechlibar commented 8 years ago

Indeed I do. The plugin name is Youtube Embed by David Artiss. It has been tested against the latest release of Wordpress.

I inserted the video using the following embed code:

[youtube]HbWrJWWn9nU[/youtube]

jeherve commented 8 years ago

Could you let me know what happens if you insert the video on its line, like so, instead:

text

https://www.youtube.com/watch?v=HbWrJWWn9nU

text
Marian-Kechlibar commented 8 years ago

I must admit I am a bit afraid of playing with a live production server which receives about 100 visitors per hour right now.

I suppressed the error by editing php.ini, wp-config.php, .htaccess. Set everywhere debug flags to false etc. I would probably have to revert those in order to produce a valid observation, which would break the already published article for real visitors.

As long as I remember, I installed the Youtube Embed plugin precisely because the "simply insert video on its line" did not produce the desired effect (e.g. preview of the video with control panel).

jeherve commented 8 years ago

I was able to reproduce the issue on a test site of mine, thank you 👍

I installed the Youtube Embed plugin precisely because the "simply insert video on its line" did not produce the desired effect (e.g. preview of the video with control panel).

It might be worth investigating this issue, as WordPress' core embed method seems to work just fine on my end: when pasting a video URL on its own line, it's immediately rendered in the post editor:

screen recording 2016-08-01 at 03 06 pm

The end result for your readers is the same, regardless of the embed method you use:

screen shot 2016-08-01 at 3 07 35 pm

That said, I don't doubt that the Youtube Embed plugin offers some options that are not available with WordPress' default embed method or with the Jetpack shortcode, as there seems to be quite a lot of options available in the Youtube Embed menu.

I also don't want you to switch to a different plugin; Jetpack should play well with each and every plugin you use on your site.

It seems Jetpack conflicts with the shortcode format used by Youtube Embed. We'll see what we can do about this.

jeherve commented 8 years ago

I edited the original issue description to include specific steps to reproduce the issue.

stale[bot] commented 6 years ago

This issue has been marked as stale. This happened because:

No further action is needed. But it's worth checking if this ticket has clear reproduction steps and it is still reproducible. Feel free to close this issue if you think it's not valid anymore — if you do, please add a brief explanation.