Probleme since last POPUP PRO update

This morning, when POPUP PRO was updated, and now, I get this php error :

'Warning: Invalid argument supplied for foreach() in /home/tmwtechn/www/wp-tmw/wp-content/plugins/popover/inc/class-popup-base.php on line 636'

Could you help us to solve that ?

Thank you in advance

Best regards

Loïc REMY

  • Adam Czajczyk

    Hey Remy,

    I hope you're having a great day and thanks for your question!

    I've checked this on my own test install but wasn't able to replicate the warning in question. That said, are you getting this message everywhere on only in your dashboard (if so, everywhere in the dashboard or only on particular screens?)? Please advise!

    Also, please make sure that there's either no "define('WP_DEBUG', true)" line in in your wp-config.php file at all or it says "define('WP_DEBUG', false)".

    Regards,
    Adam

  • Vinod Dalvi

    Hi Loïc,

    Thank you for your reply.

    I could confirm the issue on your site but couldn't reproduce it on my test site using latest version of PopUp Pro plugin and setting wp debug to true.

    This may be related with some specific popup pro settings so would you mind if I logged in to your site and did some troubleshooting? This might help get to the bottom of this faster. If this is ok, just grant me temporary admin access to your site by clicking "Grant Access" button in the WPMU DEV Dashboard Settings as described on the following page and reply on this thread after granting it?

    https://premium.wpmudev.org/manuals/wpmu-dev-dashboard-enabling-staff-login/

    You can just try resolving it by editing the following PopUp Pro plugin file on line number 635 as displayed below or just replace the following plugin file with the attached modified plugin file containing the fix.

    PopUp Pro plugin file :
    wp-content/plugins/popover/inc/class-popup-base.php

    Before Editing :

    foreach ( $popup_ids as $id ) {
    	$popup = IncPopupDatabase::get( $id );
    
    	if ( $popup_id ) {
    		// Forced popup ignores all conditions.
    		$show = true;
    	} else {
    		// Apply the conditions to decide if the popup should be displayed.
    		$show = apply_filters( 'popup-apply-rules', true, $popup );
    	}
    
    	// Stop here if the popup failed in some conditions.
    	if ( ! $show ) { continue; }
    
    	// Stop here if the user did choose to hide the popup.
    	if ( ! $_REQUEST['preview'] && $this->is_hidden( $id ) ) { continue; }
    
    	$popups[] = $popup;
    }

    After Editing :

    if( !empty($popup_ids) ){
    	foreach ( $popup_ids as $id ) {
    		$popup = IncPopupDatabase::get( $id );
    
    		if ( $popup_id ) {
    			// Forced popup ignores all conditions.
    			$show = true;
    		} else {
    			// Apply the conditions to decide if the popup should be displayed.
    			$show = apply_filters( 'popup-apply-rules', true, $popup );
    		}
    
    		// Stop here if the popup failed in some conditions.
    		if ( ! $show ) { continue; }
    
    		// Stop here if the user did choose to hide the popup.
    		if ( ! $_REQUEST['preview'] && $this->is_hidden( $id ) ) { continue; }
    
    		$popups[] = $popup;
    	}
    }

    Regards,
    Vinod Dalvi

  • Adam Czajczyk

    Hey Loïc!

    I think we've got a workaround, a future solution and a reason all together :slight_smile:

    I've activated a popup for your site (the one you gave in your previous post) and voila! There's no error.

    This is of course a workaround, so either you'll keep the popup active or you need to disable the plugin completely in order to temporary disable all popups at once.

    The future fix would most likely be identical to @Vinod Dalvi's code but I cannot give you any ETA on this. Hopefully it will be added to the nearest release. I've passed the info on it to the plugin's developer.

    The reason is that when there's no popup active the plugin is anyway trying to load it.

    I hope that helps!
    Cheers,
    Adam