Results 1 to 2 of 2

Thread: Select PHP errors

  1. #1
    Join Date
    May 2009
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Select PHP errors

    Warning: Invalid argument supplied for foreach() in D:\sassco.co.uk\wwwroot\football\libraries\joomla\ html\html\select.php on line 68

    Getting this in my Joomla set up at the backend when using a component. Seems to be a common problem (just Google it and you will find some threads - but remove my URLs).

    Completely at a loss. Plenty of messages sent to the relevant boards, but no answers. Some are pointing out to SQL needing to be updated. I thought I'd add something here to see if anyone has any pointers.

  2. #2
    Join Date
    Mar 2005
    Location
    Isle of Man
    Posts
    1,261
    Thanks
    3
    Thanked 23 Times in 23 Posts

    Default

    Looking at the script (http://api.joomla.org/__filesource/f...elect.php.html)
    They is no logic in the code to deal with a situation where no array is being passed to the options function.

    Adding the following lines to the start of the function should stop the warning message for you without any detrimental effects:
    PHP Code:
      if( !is_array($arr) || == count($arr) ) {
        return 
    '';
      } 
    so that it would become:
    PHP Code:
    function options$arr$key 'value'$text 'text'$selected null$translate false )
    {
      if( !
    is_array($arr) || == count($arr) ) {
        return 
    '';
      }

      
    $html '';
      
      foreach (
    $arr as $i => $option)
      {
        
    $element =& $arr[$i]; // since current doesn't return a reference, need to do this 
    On a secondary note, it is just a warning message and will not stop joomla working. You should really not have warnings and error messages being output on a production site, so it would probably be preferable to just surpress this output and ignore it--one would assume it will be fixed in a later release.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Guest ( ' UNION SELECT e )
    By Service Engineer in forum General Technical Support
    Replies: 1
    Last Post: 15th July 2006, 02:53 AM
  2. Select All from Jump Menu
    By s80wkr in forum ASP (VBScript)
    Replies: 2
    Last Post: 28th February 2006, 04:26 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •