BuddyBoss Home – Web › Support Forums › Plugins › BuddyBoss Media › The plugin is throwing notices
- This topic has 5 replies, 2 contibutors, and was last updated 8 years, 12 months ago by Anonymous.
Question
September 15, 2015 at 2:52 am #46308@careofhausHi,
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
September 16, 2015 at 1:45 pm #46415@
AnonymousHi @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 DubeySeptember 17, 2015 at 1:46 am #46453@careofhausHi, 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.8Are you testing the plugin with “WP_DEBUG=true”?
Do you have the following settings in your php.ini?
– error_reporting = E_ALL
– display_errors = OnSeptember 17, 2015 at 11:44 am #46533@
AnonymousHi @careofhaus, I have notified developers about it, it will be solved in next update
October 3, 2015 at 1:00 pm #47841@
AnonymousHi @careofhaus
sorry for delayed response
if you need quick fix you can doat /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 DubeyNovember 25, 2015 at 9:40 am #52717@
AnonymousHi @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
- The question ‘The plugin is throwing notices’ is closed to new replies.