Page 1 of 1

[solved]Invalid argument supplied for foreach() CGExtentions

Posted: Sun Jul 28, 2013 3:43 am
by pedes
Hello,

I'm using for a CMSMS website, modules Compagny Directory en Postcode.
In this website there is a search that return a list of Compagny Directory based on the given postalcode. And also shows the Compagny locations in a map.
I can search in 4 country with a drop down list (see the error).

This works fine, until i upgraded the modules postcode (and the cgextentions module, because the latest postcode module needs the latest cgextentions module).
After this upgrade i get a error in the admin of postcode module and in the frond-end (see attached files).

Code: Select all

Warning: Invalid argument supplied for foreach() in /home/mijnaccount/domains/mijndomein.be/public_html/modules/CGExtensions/CGExtensions.module.php on line 683
on the line 683 in the code of CGExtentions.module.php, i have this code:

Code: Select all

/*
   * A convenience function to create a country dropdown list
   */
  function CreateInputCountryDropdown($id,$name,$value='US',$selectone=false,$addtext='')
  {
    $tmp = $this->get_country_list();

    $countries = array();
    if( $selectone !== false ) $countries[$this->Lang('select_one')] = '';
    foreach($tmp as $row) {
      $countries[$row['name']] = $row['code'];
    }
    return $this->CreateInputDropdown($id,$name,$countries,-1,
                  strtoupper($value),$addtext);
  }
I already put back the previous version of postcode module, but i got the same error, so i asume this could be a problem from CGExtentions module ?

The search seems to work so far i have tested it, but i keep getting the error ?? And in the postcode module the country dropdown is empty (see attached file).
Anyone has any idea to solve this ?

My system information:
CMSMS: 1.11.7
CMSMailer 5.2.1
FileManager 1.4.3
MenuManager 1.8.5
ModuleManager 1.5.5
FormBuilder 0.7.3
Captcha 0.4.6
CGExtensions 1.37
JQueryTools 1.2.5
CGSimpleSmarty 1.7
CompanyDirectory 1.19.2
Postcode 1.2.1
CGGoogleMaps 2.4.7
FrontEndUsers 1.21.17
CustomContent 1.9
SelfRegistration 1.8
CGSmartImage 1.11


Thank you for reading this, hope to find some help.
Kind regards,
Peter

Re: Invalid argument supplied for foreach() .. CGExtentions

Posted: Sun Jul 28, 2013 4:42 pm
by calguy1000
Please upgrade CGExtensions to 1.37.1

I fixed a bug.

Thanks.

Re: [solved]Invalid argument supplied for foreach() CGExtent

Posted: Sun Jul 28, 2013 6:41 pm
by pedes
calguy,

I have to thank you very much for this.
The problem is solved with upgrading CGExtentions to version 1.37.1.

Thank you !

Kind regards
Peter