When I try to encode a YouTube video, I get:

Fatal error: Class 'Zend_Uri_Http' not found in /home/[site]/public_html/sites/all/libraries/zend/library/Zend/Gdata/App.php on line 643

I tried inserting the last three lines as suggested in this post (appending ", $path") at line 32 of media_youtube.api.inc:

http://my-sliit.blogspot.com/2010/08/fatal-error-class-zendurihttp-zendg...

So that the whole section now reads as follows:

$path = media_youtube_zend_path();
Zend_Loader::loadClass('Zend_Gdata_YouTube', $path);
Zend_Loader::loadClass('Zend_Gdata_App_Exception', $path);
Zend_Loader::loadClass('Zend_Gdata_App_HttpException', $path);
Zend_Loader::loadClass('Zend_Gdata_App_Extension_Control', $path);
Zend_Loader::loadClass('Zend_Gdata_YouTube_Extension_State', $path);
Zend_Loader::loadClass('Zend_Gdata_AuthSub', $path);
Zend_Loader::loadClass('Zend_Gdata_ClientLogin', $path);
Zend_Loader::loadClass('Zend_Uri_Http', $path);

No dice. This is with both the 1.10.8 and 1.10.7 Zend Gdata packages.

Marking this as critical because, at least on this end, it's a showstopper.

Any ideas here? Would love to be able to use the functionality of this module... thanks!

CommentFileSizeAuthor
#3 media_youtube.patch1.59 KBAnonymous (not verified)
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

bcobin’s picture

Zend GData 1.10.2 seems to work - hope this helps...

chezwel’s picture

worked for me thanks bcobin

Anonymous’s picture

FileSize
1.59 KB

or you may also use 1.10.8 and patch media_youtube.module. Patch included.

butler360’s picture

Patch in #3 works, although I had trouble applying it and had to do it manually.

I was getting this error just trying to edit a node with an inline YouTube link. I don't use media mover or any of these features, so is Zend really required for me?

HongPong’s picture

Subscribing - I think i am having a WSOD with this? Can't tell though.

Danny Englander’s picture

Same issue WSOD. The patch also failed for me but I don't know enough about the code to apply it manually. I tired updating to Zend Gdata 1.10.8 but that did not work either.

GreenSkunk’s picture

Issue tags: +apply.patch

Modules Installed:

  • Embedded Media Field 6.x.2.1
  • Media: YouTube 6.x-1.x-dev

Download Required Libraries

  1. Download the latest stable release of Zend Gdata
  2. Unpack ZendGdata-1.10.8.tar.gz and you'll have a resulting folder structure of
    ZendGdata-1.10.8
    - library
    -- Zend
  3. Place the Zend folder in your site's libraries folder (if you don't have a libraries folder within /sites/all then you'll have to create one). i.e. [YOUR-WEBSITE]/sites/all/libraries/Zend

Patching Files (I did this manually)

View Electron's Patch at http://drupal.org/node/895270#comment-3485800

Piece of patch

diff -pruN media_youtube/includes/media_youtube.api.inc /var/www/charlene/sites/all/modules/media_youtube/includes/media_youtube.api.inc
--- media_youtube/includes/media_youtube.api.inc_old    2010-05-13 09:18:21.000000000 +0200
+++ media_youtube/includes/media_youtube.api.inc    2010-09-23 22:46:07.214890308 +0200
@@ -29,6 +29,9 @@ function _media_youtube_check_upload($vi
   Zend_Loader::loadClass('Zend_Gdata_App_HttpException', $path);
   Zend_Loader::loadClass('Zend_Gdata_App_Extension_Control', $path);
   Zend_Loader::loadClass('Zend_Gdata_YouTube_Extension_State', $path);
+  Zend_Loader::loadClass('Zend_Gdata_AuthSub', $path);
+  Zend_Loader::loadClass('Zend_Gdata_ClientLogin', $path);
+  Zend_Loader::loadClass('Zend_Uri_Http', $path);
  1. Look for the +++ that'll tell you what file to edit
  2. Look for the @@ as that will tell you what line number to start editing on. That line will also tell you what function those lines are in. The lines after the @@ will give you an idea of what lines are prior to our lines to edit or add (in this case we're adding lines to the file).
  3. + means that we have to add that line
  4. - means that we have to remove that line

I hope this helps.

Rob_Feature’s picture

I ran this patch with the latest (oct 10) dev version of media_youtube and I still get the same error. Anyone else?

dddave’s picture

sub

Fidelix’s picture

This is ridiculous. The maintainers update the module without testing at all?

i know you're doing a free contribution to the community, and we all appreciate that.
But this lack of responsibility is really frustrating...

About the patch. I tried applying it manually but could not get it to work... I'll go some versions back for now...

HongPong’s picture

Still having WSOD -Really wish it were more possible to diagnose the source of it.

Fidelix’s picture

HongPong, you may go to 6.x-1.1 and your problem will go away.

When this issue is solved, then you may update.

aaron’s picture

Status: Active » Postponed (maintainer needs more info)

I have not been able to reproduce the error. I assume that everyone here is using Media: Mover (as the Zend library shouldn't even be called w/o that). Please let me know more details: the versions of media mover, media: youtube, emfield, drupal, php, zend. Also where you have the zend library installed.

also, if you apply the patch, please let me know if it does work, or if it doesn't, and which library of zend you're using.

@Fidelix: Though I understand your frustration, your comments are little more than spiteful, and certainly less than helpful.

aaron’s picture

Issue tags: -apply.patch

also, any setting overrides you may have on the media youtube configuration page. thanks!

aaron’s picture

finally, *if* you're getting the error after applying the patch, try adding those lines to function media_youtube_check_status() in media_youtube.module and give an update, please. i'm hesitant to apply the patch w/o more testing, as i don't know if it will break sites using older versions of zend.

dddave’s picture

Hi aaron,

I am not using Media:Mover. Only emfield and media:youtube. This error occured on one of my playaround local installs and it came out of the blue (i.e. I cannot trace the exact moment it broke). As I tried to solve the problem it occurred to me that I don't know why I installed the zend-stuff in the first place. Is there any requirement for it by emfield or media:youtube? I cannot find such requirements on the project pages or the read.me files (unless I completely overlooked it).

Rhicreate’s picture

I'm also not using media mover (never installed) and although my site is still under development and so the module is only recently installed anyway - i had no mention of the need for the Zend library until upgrading to 1.2.

Then once I installed Zend, I started to get this error when trying to edit a content item with a YouTube video already embedded.

I've tried various suggestions of uninstalling/reinstalling the modules, commenting out the media mover functions and reverting to the older Zend library but without any success. I had a crack at the patch, but not sure I applied it correctly as I just got more errors...

So, I gave up and reverted back to 1.1 for now, everything's back to normal, don't need the Zend library anymore, no errors anywhere and editing the content works just fine.

mass5’s picture

I've also updated this module to 1.2 and I get the same error.
I'm a bit confused about one thing: how should I revert to 1.1 ? Just delete the 1.2 version and then copy the old version?
Does it matter if the database was updated when I first ran /update.php script for the 1.2 ?

itserich’s picture

This is why I wait for a week before applying updates.

Why I read the notes.

Apparently that is not enough.

hedac’s picture

damn... this got me crazy trying to see what I was getting the WSOD
thank you for the patch #3. now it works
Next time please check before updating a module !

VladimirAus’s picture

Seems like there is problem with Zend library location.
* sites/all/libraries/library/Zend
or
* sites/all/libraries/Zend
?
After applying patch 3 it only works for the first path mentioned.

edegro’s picture

I upgraded to this error today. I was able to fix it with this change instead:

--- /home/eric/media_youtube/media_youtube.module       2010-11-12 15:58:57.000000000 +0000
+++ media_youtube.module        2010-11-25 23:17:15.000000000 +0000
@@ -383,6 +383,7 @@
       if (media_youtube_zend_path()) {
         Zend_Loader::loadClass('Zend_Gdata_YouTube');
         Zend_Loader::loadClass('Zend_Gdata_App_HttpException', $path);
+        Zend_Loader::loadClass('Zend_Uri_Http', $path);
         $yt = new Zend_Gdata_YouTube();
         try {
           $videoEntry = $yt->getVideoEntry($video_id);
Juan C’s picture

Previously WSOD on pages with youtube.
Patch #3 fix it.
Emfield 6.2.3, Media: Youtube 6.1.2, Zend folder: /sites/all/libraries/Zend, No Media: Mover installed.

Cheers.

janis_lv’s picture

Fatal error: Class 'Zend_Loader' not found in /var/www/web2/web/sites/all/modules/media_youtube/media_youtube.module on line 384

tried patches. no luck.

noved from zip library/Zend to sites/all/libraries/Zend

oh, and I see the error when I try to save/preview node with med_ytube.

altparty’s picture

#22 worked for me.

verta’s picture

I did the patch in #3, but I had to do it manually, and it got rid of the error.
I then restored the code to the released version.
Then I did the patch in #22 and it also got rid of the error.

Drupal 6.19, IIS 6, ZendGdata-1.10.8 in sites/all/libraries/ZendGdata-1.10.8

I'm not sure what the extra code in the #3 patch is for, but if it's covering some defaults that might otherwise be left null and cause something like this again, perhaps the longer and more detailed patch is better.

Can I hear an RTBC? I think we do need the "R" part, where someone can look over the extra code in #3 and see if it's something the module should have. Thanks to all for posting the patches, it helped us out a lot.

Ross-Hunter’s picture

This is what ended up finally working for me after using the patches specified above.

Around line 300 in media_youtube.module you will find

 * @param boolean $reset
 *  (Optional) If TRUE, then reset the variable and attempt a new autodiscovery.
 * @return string
 *  The path to the Zend Gdata.php and related files.
 */
function media_youtube_zend_path($reset = FALSE) {
  static $path;

The default for $reset is false. I set it to true and then I was able to successfully upload videos. Then after it had successfully found the proper path to the Zend library I returned it to false, in order to prevent it from checking every time the module is called.

Hope this helps someone.

davedg629’s picture

Anyone know what I should do, same boat as #18. I have a backup of the database, but do I need to use it?

dcrsys’s picture

Electron's patch from #3 works great. Problem is - this is the second time I've had to patch a site - first was over a month ago. Can't we get this patch merged into the distribution code?

verta’s picture

If someone other than the developer is brave, and changes the status to "reviewed and tested by the community" it usually moves along the process. I think 'reviewed' is key, we need a PHP programmer to look at the code options and roll a patch with the preferred solution.

Michsk’s picture

Use zend 1.11.1. Works like a charm form me. Had the same issue but newest Zend fixed it.

supadits’s picture

Zend 1.11.1 also works here

verta’s picture

Should I just replace the Zend folder in sites/all/libraries? The folder structure looks different on the download I found.

Also, do I need all of the folders on my production site? There seems to be a lot of "stuff" other than the library files needed by this module.

Michsk’s picture

you dont need all the stuff. Demos for example are not needed. Just override all you got with the new download.

mastho95’s picture

#22 worked for me

FYI: my path is ....\sites\all\libraries\ZendGdata-1.10.8\library\Zend\

Thanks

Hagay’s picture

Upgrading to ZendGdata-1.11.1, solved all problems!

Strutsagget’s picture

Yes updating to latest framework seams to do fix the problem. Maybe the readme file should say that its needed after the latest patch.

aaron’s picture

Status: Postponed (maintainer needs more info) » Fixed

I've applied the patch in #3 for now. Thanks for the work everyone; it would be nice to find a solution that would work for all Zend versions. If not, it would be nice if someone could test against an older version and re-open if this causes issues.

Thanks!

Status: Fixed » Closed (fixed)

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

As If’s picture

Problem still occurring with 6.x-1.3 AND 6.x-1.x-dev. Using Emfield 6.x-2.4. NOT using Media Mover. I tried upgrading this module a bunch of different ways, including not deactivating anything and just reuploading, deactivating MYT only and reuploading, deactivating both MYT and Emfield and reuploading both of them, totally uninstalling MYT and reuploading it fresh, totally uninstalling both MYT and Emfield and reuploading both of them fresh, and even deleting the Zend folder completely. Yes I ran update.php each time (even though no updates were shown as available). Yes I cleared my cache (and theme registry for good measure). Yes I deleted the entire module folders before uploading the new versions. No matter what I do, it won't stop looking for Zend.

But here's the weirdest thing: On another site (call it Site 2) I have the latest versions of both modules running without a hitch, and Zend was never even installed. In other words, even though the new version of MYT does NOT require Zend, if you install the OLD version and then try to upgrade to the new version, there's no way to make it lose the old dependency on Zend. This sounds like a failure in the update function.

I finally got the module to run on Site 1 by commenting out the code that called Zend. That's this:

// if ($class_name == 'Zend_Loader') {
// 	include_once(media_youtube_zend_path() .'/Zend/Loader.php');
// }

and this:

// if ($path = media_youtube_zend_path()) {
//   Zend_Loader::loadClass('Zend_Gdata_YouTube', $path);
//   Zend_Loader::loadClass('Zend_Gdata_App_HttpException', $path);
//   Zend_Loader::loadClass('Zend_Gdata_AuthSub', $path);
//   Zend_Loader::loadClass('Zend_Gdata_ClientLogin', $path);
//   Zend_Loader::loadClass('Zend_Uri_Http', $path);
// 
//   $yt = new Zend_Gdata_YouTube();
//   try {
//     $videoEntry = $yt->getVideoEntry($video_id);
//     $status[$video_id] = EMFIELD_STATUS_AVAILABLE;
//   }
//   catch (Exception $e) {
//     $status[$video_id] = EMFIELD_STATUS_UNAVAILABLE;
//     $message = 'Video unavailable at !link: @error.';
//     $variables = array('@error' => $e->getMessage(), '!link' => l(media_youtube_video_url($video_id), media_youtube_video_url($video_id)));
//     watchdog('media_youtube', $message, $variables, WATCHDOG_ERROR);
//   }
// } else {
  // We don't have the Zend library, so there's no way to know for certain.
  $status[$video_id] = EMFIELD_STATUS_AVAILABLE;
// }

Note that edit leaves the line $status[$video_id] = EMFIELD_STATUS_AVAILABLE; uncommented. That's the line you *want* to run.