BuddyBoss Home – Web Support Forums Plugins BuddyBoss Media The plugin is throwing notices

Viewing 6 posts - 1 through 6 (of 6 total)
  • Question

    #46308
    @careofhaus

    Hi,

    When i upload a file it works fine until it shows up in the media library.

    I get this notice:

    Notice: Undefined offset: 1 in /plugins/buddyboss-media/includes/types/photo-hooks.php on line 319

    When i debug the code I get the following:

    $media_ids = array (size=2)
    0 => int 887
    1 => string ” (length=0)

    $filesizes = array (size=1)
    0 => string ‘medium’ (length=6)

    This makes the foreachloop on line 318 to do to many itterations.

    When $filesizes is created you use array_filter() to remove empty $media_ids.

    Would it be an ok fix to make the folowing changes around line 295?

    $media_ids = array_filter($media_ids );
    
    $filesizes = array();
        switch( count( $media_ids ) ){ 

    Answers

    #46415

    Anonymous
    @

    Hi @careofhaus, we have pushed an update today , it will solve above issue
    We are already modified to

    $filesizes = array();
    switch( count( array_filter($media_ids )) )

    Regards
    Varun Dubey

    #46453
    @careofhaus

    Hi, the update (3.0.8) dit not fix my notice.

    ( ! ) Notice: Undefined offset: 1 in /plugins/buddyboss-media/includes/types/photo-hooks.php on line 318

    Your row “switch( count( array_filter($media_ids )) )” is not removing the empty values from $media_ids.
    The notice happens in the foreach on 318 because $media_id is an empty string in one of the itterations.
    If you follow my suggestion to remove the empty $media_ids permanently the notice go away.

    To reproduce the notice
    – Go to the global activity page
    – Post a picture
    See attached picture.

    My config is the following:
    PHP 5.5.23
    WP 4.3
    BP 2.3.3
    Buddyboss media wall 3.0.8

    Are you testing the plugin with “WP_DEBUG=true”?

    Do you have the following settings in your php.ini?
    – error_reporting = E_ALL
    – display_errors = On

    #46533

    Anonymous
    @

    Hi @careofhaus, I have notified developers about it, it will be solved in next update

    #47841

    Anonymous
    @

    Hi @careofhaus
    sorry for delayed response
    if you need quick fix you can do

    at /plugins/buddyboss-media/includes/types/photo-hooks.php on line 318

    replace

    
    foreach( $media_ids as $media_id ) { 
    $media_ids = array_filter($media_ids );
    

    with

    
    $media_ids = array_filter($media_ids );
    foreach( $media_ids as $media_id ) {
    

    Else please wait for our next update
    It is fixed in our development version.

    Regards
    Varun Dubey

    #52717

    Anonymous
    @

    Hi @careofhaus, Sorry for delay

    It is fixed in our current 3.1.1 update.
    Can you confirm the same for your site?
    Regards
    Varun Dubey

Viewing 6 posts - 1 through 6 (of 6 total)
  • The question ‘The plugin is throwing notices’ is closed to new replies.