For media_youtube/vimeo I get this error when I use drush to install a profile that contains demo media content.

This seems to be a hiccup where something is not ready during the install but is only a temporary problem. I think it can be fixed by just wrapping the $wrapper->get_parameters() in an is_object($wrapper) conditional statement. This fixed the issue for me on OpenChurch.

http://drupal.org/node/1585348#comment-6156296

I can patch it for OpenChurch but I think it would be wise to add an is_object() condition or something similar to have a safe fallback if the wrapper object isn't populated.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

andersiversen’s picture

I have this error as well - any news of a fix on it's way to head/dev versions?

RobW’s picture

I haven't run into this error. Can you give steps to reproduce on a fresh (non-distribution) Drupal install?

rli’s picture

I have this error too.

When I go to my video content type -> manage display for my video field, and change the format to 'Media style: original', I started to get this error.

I tried to var_dump the $parts out in line 17, then I realized:
for the first time I visit my video content node after I save the setting, I can see the $parts is an array like this 'array(1) { ["v"]=> string(11) "xxxxxxxxxxxx" } ', whereas when I reload the page, this error will happen and the $variables['uri'] will become null, which I guess is causing the error?

I think even I add a condition to check if $wrapper is an object, I still can not see the players appearing in the node as there is only one element in $parts array?

Hope this can help.

Junni’s picture

I came across this bug, created a patch for it based on a media_vimeo patch.

daniel_j’s picture

The attached patch applies cleanly to 7.x-3.0, and resolves the issue somewhat more elegantly as it does not generate any PHP warnings concerning undefined variables or indexes.

daniel_j’s picture

Version: 7.x-1.0-beta3 » 7.x-3.0
Status: Active » Needs review
joseph.olstad’s picture

joseph.olstad’s picture

needs review

steinmb’s picture

Version: 7.x-3.0 » 7.x-3.x-dev
Related issues: +#2869366: Problem with function file_uri_to_object after media module update

The patch make sense though. How can I re-produce the bug?

Update: one way would be to run:

php scripts/run-tests.sh --class MediaInternetYouTubeTestCase

Drupal test run
---------------

Tests to be run:
 - YouTube file handler provider (MediaInternetYouTubeTestCase)

Test run started:
 Wednesday, June 21, 2017 - 05:03

Test summary
------------


Fatal error: Call to a member function get_parameters() on boolean in /Users/steinmb/sites/flickr/7.x-2.x/drupal/sites/all/modules/media_youtube/themes/media_youtube.theme.inc on line 15

Call Stack:
    0.0022     363848   1. {main}() /Users/steinmb/sites/flickr/7.x-2.x/drupal/scripts/run-tests.sh:0
    0.0063     826872   2. simpletest_script_run_one_test() /Users/steinmb/sites/flickr/7.x-2.x/drupal/scripts/run-tests.sh:26
    0.1295   16096024   3. DrupalTestCase->run() /Users/steinmb/sites/flickr/7.x-2.x/drupal/scripts/run-tests.sh:386
   13.5808   34335192   4. MediaInternetYouTubeTestCase->testYouTubeFileHandling() /Users/steinmb/sites/flickr/7.x-2.x/drupal/modules/simpletest/drupal_web_test_case.php:527
   13.5927   34356312   5. theme() /Users/steinmb/sites/flickr/7.x-2.x/drupal/sites/all/modules/media_youtube/media_youtube.test:87
   13.6820   35344384   6. media_youtube_preprocess_media_youtube_video() /Users/steinmb/sites/flickr/7.x-2.x/drupal/includes/theme.inc:1125

FATAL MediaInternetYouTubeTestCase: test runner returned a non-zero error code (255).

Test run duration: 13 sec

steinmb’s picture

With the patch applied did it run further though:

php ../../../../scripts/run-tests.sh --class MediaInternetYouTubeTestCase

Drupal test run
---------------

Tests to be run:
 - YouTube file handler provider (MediaInternetYouTubeTestCase)

Test run started:
 Wednesday, June 21, 2017 - 05:09

Test summary
------------


Fatal error: Call to a member function getLocalThumbnailPath() on boolean in /Users/steinmb/sites/flickr/7.x-2.x/drupal/sites/all/modules/media_youtube/media_youtube.test on line 98

Call Stack:
    0.0048     363848   1. {main}() /Users/steinmb/sites/flickr/7.x-2.x/drupal/scripts/run-tests.sh:0
    0.0138     826872   2. simpletest_script_run_one_test() /Users/steinmb/sites/flickr/7.x-2.x/drupal/scripts/run-tests.sh:26
    0.1152   16096024   3. DrupalTestCase->run() /Users/steinmb/sites/flickr/7.x-2.x/drupal/scripts/run-tests.sh:386
   14.1718   34339928   4. MediaInternetYouTubeTestCase->testYouTubeFileHandling() /Users/steinmb/sites/flickr/7.x-2.x/drupal/modules/simpletest/drupal_web_test_case.php:527

FATAL MediaInternetYouTubeTestCase: test runner returned a non-zero error code (255).

Test run duration: 14 sec
joseph.olstad’s picture

looks like the patch is good.

As for the test, can you debug getLocalThumbnailPath() ?
figure out why getLocalThumbnailPath() isn't happy.
comparing this:

file_default_scheme() . '://media-youtube/'

to this from exception code:

variable_get('media_icon_base_directory', 'public://media-icons')

I'm not sure if either of these is valid: '://media-youtube ' or 'public://media-icons'

I think if this test call to getLocalThumbnailPath() is solved
then we can resolve this critical issue:
#2883644: Fix head tests for media_youtube 7.x-3.1

It could be that the above patch will help us solve
#2883644: Fix head tests for media_youtube 7.x-3.1

  • Junni authored 88cf7c6 on 7.x-3.x
    Issue #1658006 by joseph.olstad, daniel_j, Junni: Fatal error: Call to a...
joseph.olstad’s picture

Status: Needs review » Fixed

patch 8 committed as-is.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.