After upgrading to a7, I get a bunch of these errors, that did not appear in a5 or a6.

Notice: Trying to get property of non-object in file_styles_styles_filter() (line 37 of /sites/all/modules/styles/contrib/file_styles/file_styles.module).
Notice: Trying to get property of non-object in media_youtube_file_styles_filter() (line 65 of /sites/all/modules/media_youtube/includes/media_youtube.styles.inc).
Notice: Trying to get property of non-object in file_styles_styles_filter() (line 53 of /sites/all/modules/styles/contrib/file_styles/file_styles.module).

The second one can be eliminated by turning off the media_youtube module, and there's a companion bug report that was already filed for that: #1174950: Trying to get property of non-object in media_youtube_file_styles_filter()

However the first and last ones (lines 37 and 53) continue to display on all pages (even admin pop-up dialogues, like views settings).

Happy to provide more information or help troubleshoot and test. I'm running Drupal 7.2.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rootwork’s picture

For reference, alpha7 inserts the following just before line 37:

  // Media objects have the file stored as a property of the object.
  if (isset($object->file)) {
    $object = $object->file;
  }

Removing that will remove the errors.

Not suggesting this is a fix, just identifying the source of the errors.

pazap47’s picture

Same problem

drupnewbie’s picture

Issue tags: -media_youtube

same issue after updating from beta 5 to 7. Probably the issue is followed by same style troubles regarding the correct display of file styles (colorbox load the original file).

THX for helping

Ray

Aracon’s picture

Results of a quick research:
1) The code that gets an error (file_styles.module, line 30):

function file_styles_styles_filter($object, $element = NULL) {
  // Media objects have the file stored as a property of the object.
  if (isset($object->file)) {
    $object = $object->file;
  }
  // Ensure we're working against the fully loaded file object.
  $file = file_styles_uri_to_object($object->uri, TRUE);

2) The variable $object when entering the function has the value:

stdClass Object
(
    [fid] => 8
    [display] => 1
    [description] => 
    [uid] => 1
    [filename] => gFwYq7UE45g
    [uri] => youtube://v/gFwYq7UE45g
    [filemime] => video/youtube
    [filesize] => 0
    [status] => 1
    [timestamp] => 1306925246
    [type] => video
    [file] => Array
        (
            [und] => Array
                (
                    [0] => Array
                        (
                            [fid] => 8
                            [display] => 1
                            [description] => 
                            [uid] => 1
                            [filename] => gFwYq7UE45g
                            [uri] => youtube://v/gFwYq7UE45g
                            [filemime] => video/youtube
                            [filesize] => 0
                            [status] => 1
                            [timestamp] => 1306925246
                            [type] => video
                        )

                )

        )

)

And before the last line ($file=...):

Array
(
    [und] => Array
        (
            [0] => Array
                (
                    [fid] => 8
                    [display] => 1
                    [description] => 
                    [uid] => 1
                    [filename] => gFwYq7UE45g
                    [uri] => youtube://v/gFwYq7UE45g
                    [filemime] => video/youtube
                    [filesize] => 0
                    [status] => 1
                    [timestamp] => 1306925246
                    [type] => video
                )

        )

)

So, maybe, some other code forms wrong object, or the object should have another structure... Because I don't know the proper structure of the object that should be passed to this function, I can't make further investigations.

3) Notices appear in media_youtube module because it relies on the same assumptions (that the $object has $object->uri and similar fields), errors appear in media_youtube.styles.inc (line 65) and in MediaYouTubeStyles.inc (line 30), maybe somewhere else. All that code relies on file_styles module, so I think that the problem is in file_styles, not in media_youtube.

kgc’s picture

I had the same error:

Notice: Trying to get property of non-object in file_styles_styles_filter() (Zeile 37 von sites/all/modules/styles/contrib/file_styles/file_styles.module)

The error is shown after Update the Styles Modul to 7.x-2.0-alpha7 on all pages where images shown.

keha3912’s picture

confirm error

davidsanger’s picture

sub

aaron’s picture

crud, just figured it out -- my changes to the styles module were dependent on new changes in media that haven't been rolled into a release yet. until i figure out how to accommodate older versions of media, you can fix by updating media to the latest from git. terribly sorry... i'll try to fix asap...

rootwork’s picture

Aaron, can you confirm that's what's causing #1174950: Trying to get property of non-object in media_youtube_file_styles_filter() too? If so then I'll mark that one as a dupe and we can follow the fixing of this bug here.

aaron’s picture

Status: Active » Needs review
FileSize
758 bytes

here's a quick fix...

arievdonk’s picture

same here

Carlos Miranda Levy’s picture

Patch #10 applied and worked! Videos are back and errors are gone yeahhh :p
Thanks!

rootwork’s picture

Confirmed that the patch in #10 fixes the issue. Aaron, since you say it's a "quick fix" perhaps you want to leave this open, so I won't set the status to fixed.

I also marked #1174950: Trying to get property of non-object in media_youtube_file_styles_filter() as a duplicate, as the patch fixes that issue too.

aaron’s picture

actually, this patch is more thorough, and works (for me) on both the beta4 and dev releases of media, and the latest version of media youtube. it's also cleaner.

rootwork’s picture

Yep, #14 fixes it as well. And you're right that it's a lot cleaner.

aaron’s picture

Status: Needs review » Fixed

great, thanks @rootwork! committed.

keha3912’s picture

thx

pazap47’s picture

Yes perfect it works. Great job!

ts145nera’s picture

Great!!!

xpla’s picture

Still have the following issue:

    Notice: Undefined property: stdClass::$uri in file_styles_styles_filter() (Zeile 33 von /usr/web/docs/bwl1www/wi/drupal7/sites/all/modules/styles/contrib/file_styles/file_styles.module).
    Notice: Undefined property: stdClass::$uri in media_youtube_file_styles_filter() (Zeile 65 von /usr/web/docs/bwl1www/wi/drupal7/sites/all/modules/media_youtube/includes/media_youtube.styles.inc).
    Notice: Undefined property: stdClass::$filemime in file_styles_styles_filter() (Zeile 49 von /usr/web/docs/bwl1www/wi/drupal7/sites/all/modules/styles/contrib/file_styles/file_styles.module).

Anyone?

Anders Hansen’s picture

Same here, still have the error.

Notice: Undefined property: stdClass::$uri in file_styles_styles_filter() (line 33 of /home/appnyt/public_html/sites/all/modules/styles/contrib/file_styles/file_styles.module).
Notice: Undefined property: stdClass::$filemime in file_styles_styles_filter() (line 49 of /home/appnyt/public_html/sites/all/modules/styles/contrib/file_styles/file_styles.module).

rooby’s picture

@xlpa & Anders Hansen:

I have opened a new issue for the undefined property errors here #1186624: Undefined property stdClass::$uri and stdClass::$filemime in file_styles_styles_filter()

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