Topic: Invalid argument supplied for foreach() in file:

When I Open Page I saw That

Invalid argument supplied for foreach() in file: /home/choudh1/domains/choudharyenterprises.tk/public_html/includes/session.inc at line 342


Give Solutin Please

Re: Invalid argument supplied for foreach() in file:

You are right rajbirdhaka. Although the bug is quite harmless, it will be fixed to next minor. The bug shows up when starting up FA, but only if you have specific warnings enabled.

/Joe

Re: Invalid argument supplied for foreach() in file:

Hi Joe, expect that this issue has been solved in the latest Mercurial 3122 in session.inc

Re: Invalid argument supplied for foreach() in file:

No, this is because of a missing include file ...../installed_extensions.php. It only appears when starting up. The include file is coming later in session.inc. It is totally harmless, however do not look nice.

Janusz is going to fix this asap.

/Joe

Re: Invalid argument supplied for foreach() in file:

Thanks Joe, maybe an "@" should do it!.

Re: Invalid argument supplied for foreach() in file:

If the file installed_extensions.php does not exist, why not hard code it's content into the script? And if the content needs to be written and saved and the file is still missing, then it can be created!

Alternatively, just create it if it is missing - with some acceptable default content - and then read it back into the current script!

Re: Invalid argument supplied for foreach() in file:

The installed_extensions.php file is properly created during installation. Nevertheless I have found small bug in system tests (main FA folder was not tested properly whether it is writable or not). Fixed for next release.
Janusz

Re: Invalid argument supplied for foreach() in file:

Yes, the function check_write() in includes/main.inc should cover the lang folder check as well.

In install/index.php mustn't there be a check to see if lang folder is writeable?

    if (!file_exists($path_to_root . "/lang/installed_languages.inc")) {
        $installed_languages = array (
            0 => array ('code' => 'C', 'name' => 'English', 'encoding' => 'iso-8859-1'));
            $dflt_lang = 'C';
            write_lang();
    }

Re: Invalid argument supplied for foreach() in file:

The lang folder check is included in system_test.inc, and result is displayed on leading installer page.
Janusz

10 (edited by apmuthu 12/19/2012 08:32:29 pm)

Re: Invalid argument supplied for foreach() in file:

Oh yes, thanks. Lines 238-240 in system_tests.inc do it:

    $fname =  $path_to_root.'/lang';
    $test['test'] = $fname;
    if (!(is_dir($fname) && is_writable($fname))) {