Support » Plugin: Podcast Feed Player Widget and Shortcode » Warning: Invalid Argument

  • Hi! 🙂

    I’ve noticed that at the top of a feed i’ll get the warning

    “Warning: Invalid argument supplied for foreach() in /home/autosce3/public_html/ on line 251”

    The actual feed seems to work ok, but this warning will appear at the top of it. Any ideas how I can remedy this?

    Kind Regards

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • I’m getting the exact same error and would love to be able to fix it too.

    Ditto. From my 15 minute peeking, there is something awry with the dkpp_podcastfeed() function.

    $feedurl = $atts['feedurl'];

    Line 235 reads the attributes, which can be comma separated for multiple feeds.

    There is an SSL test where the error occurs at line 244:

       if( strpos($feedurl, ',') !== false ) {
            $feedurls = explode(',', $feedurl);
        } else {
        	$feedurls = $feedurl;

    Which means $feedurls ends up as an array for more than one URL, and a string otherwise, hence the error will occur with the code starting at line 250, because for one URL its trying to run foreach on a string. ERROR.

    	if (is_ssl()) {
    		foreach ($feedurls as $url) {
    			if(!preg_match( '|^https ?://|', $url )) {
    			 	$ssltest = $ssltest + 1;
    			 	$nonssl .= $url. ", ";

    I just tested commenting out lines 244-248 and replacing with what is done in other functions

    $feedurls = explode(',', $feedurl);

    and the error went away.

    That’s just some guesswork looking at the code; feed_fetch works fine on an array.

    • This reply was modified 1 year, 3 months ago by cogdog.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Warning: Invalid Argument’ is closed to new replies.