Always i get this message :
Warning: class_implements(): object or string expected in file_get_stream_wrappers() (line 136 of /var/www/drupalcommons/web/includes/file.inc).
Warning: in_array() expects parameter 2 to be array, boolean given in file_get_stream_wrappers() (line 136 of /var/www/drupalcommons/web/includes/file.inc).

Any idea ?

Comments

lsolesen’s picture

Status: Active » Postponed (maintainer needs more info)
Issue tags: -class_implements, -file_get_stream_wrappers, -file.inc, -line 136

Could you supply the exact steps to reproduce?

virk’s picture

When i just login as administrator i alway get this message on the top of the site

virk’s picture

Nobody to help me to remove this irritating messages at the top of my site?
i using drupal commons 7.x-3.1

lsolesen’s picture

Try updating to 3.13

virk’s picture

Sorry i am using 7.x-3.13 not 7.x-3.1 ...

alcroito’s picture

Status: Postponed (maintainer needs more info) » Active

Hi, I'm getting the same thing and I think I know where it comes from.
The $wrappers in file_get_stream_wrappers contains 2 values for the 'oembed' key.
This is what $wrappers contains.

$wrapper = array (
  'oembed' => 
  array (
    'name' => 
    array (
      0 => 'oEmbed resources',
      1 => 'oEmbed resources',
    ),
    'class' => 
    array (
      0 => 'MediaOEmbedStreamWrapper',
      1 => 'OEmbedStreamWrapper',
    ),
    'description' => 
    array (
      0 => 'Remote resources hosted on any website that supports the oEmbed API.',
      1 => 'Resources provided by oEmbed.',
    ),
    'type' => 
    array (
      0 => 20,
      1 => 20,
    ),
  ),
  'public' => 
  array (
    'name' => 'Public files',
    'class' => 'DrupalPublicStreamWrapper',
    'description' => 'Public local files served by the webserver.',
    'type' => 29,
  ),
  'temporary' => 
  array (
    'name' => 'Temporary files',
    'class' => 'DrupalTemporaryStreamWrapper',
    'description' => 'Temporary local files for upload and previews.',
    'type' => 13,
    'private' => true,
  ),
  'module' => 
  array (
    'name' => 'Module files',
    'class' => 'ModuleSystemStreamWrapper',
    'description' => 'Local module files.',
    'type' => 4,
  ),
  'theme' => 
  array (
    'name' => 'Theme files',
    'class' => 'ThemeSystemStreamWrapper',
    'description' => 'Local theme files.',
    'type' => 4,
  ),
  'profile' => 
  array (
    'name' => 'Profile files',
    'class' => 'ProfileSystemStreamWrapper',
    'description' => 'Local profile files.',
    'type' => 4,
  ),
  'library' => 
  array (
    'name' => 'Library files',
    'class' => 'LibrarySystemStreamWrapper',
    'description' => 'Local library files.',
    'type' => 4,
  ),
)

The class_implements($info['class']) function expects the class to be a string, but in oembed's case its an array of two strings.
I believe this is happening because both the oembed and media_oembed define their own file stream wrappers.
This breaks the site form on certain pages by throwing a WSOD.
I'm using Commons 3.13.

alcroito’s picture

Commenting out oembed_stream_wrappers() fixes the issue for me, by only leaving the wrapper defined by media_oembed.
But obviously this is not a clean solution, and should be discussed with the maintainers of both oEmbed and media_oembed modules.
But there doesn't seem to be any communication or plans to making both modules work as can be seen in #2226639: Use Media: oEmbed for Media integration.

virk’s picture

Placenta,
which file should I change?
Is the file includes/file.inc file?
Thank you.

alcroito’s picture

Its in profiles/commons/modules/contrib/oembed/oembed.module
Find oembed_stream_wrappers, and comment out that function. Note that you should do it, only if you have the media_oembed module enabled, and I haven't thoroughly tested if it breaks anything, so it's on your own risk.

virk’s picture

Placinta,
The message has gone for the moment but ...
Thanks

adam_b’s picture

Placinta's suggestion is working fine for me - just had to reinstate it after upgrading to Commons v7.36

yosigosi’s picture

I tried to use hook_stream_wrappers_alter in media_oemebed with no success.

So, instead of comment the function I check if media_oembed is enabled :

/**
 *  Create stream wrapper for oEmbed videos.
 */
function oembed_stream_wrappers() {
	if(!module_exists('media_oembed')) {
	  return array(
	    'oembed' => array(
	      'name' => t('oEmbed resources'),
	      'class' => 'OEmbedStreamWrapper',
	      'description' => t('Resources provided by oEmbed.'),
	      'type' => STREAM_WRAPPERS_READ_VISIBLE,
	    ),
	  );
	}
}
darvanen’s picture

Nice one @yosigosi, that did the trick for me. I'm not sure I completely understand why though, as I have the media_oembed module enabled...