hi

i have installed pannels on a Drupal 4.7.2. i have created one 2 pane pannel for one URL and evertime i select this URL i get a error

warning: Invalid argument supplied for foreach() in c:\Inetpub\wwwroot\drupal\modules\panels\panels.module on line 695.

what is wrong?

Regards
Marc

Comments

taozen’s picture

I am receiving the same error. I am running 4.7.3.

Any input? This looks like it is a great module.

merlinofchaos’s picture

That error indicates it wasn't able to find any layouts, which mind mean you have a broken installation. Be sure that you have your 'panels' directory with panels.module in it, and you have the 'layouts' and 'content_types' directories beneath that.

newms’s picture

I am getting the exact same error, but I have the panels.module in the panels directory, and I the 'layouts' and 'content_types' directories beneath that. Any help?

marc.bau’s picture

here is my directory structure, with the files in it. I think this is correct.


 Verzeichnis von C:\Inetpub\wwwroot\drupal\modules\panels

03.08.2006  23:48    <DIR>          .
03.08.2006  23:48    <DIR>          ..
26.07.2006  18:53             5.477 API.txt
03.08.2006  23:48    <DIR>          content_types
03.08.2006  23:48    <DIR>          images
22.07.2006  08:06               405 INSTALL.txt
03.08.2006  23:48    <DIR>          layouts
12.11.2004  19:30            18.019 LICENSE.txt
22.07.2006  06:36               793 panels.install
22.07.2006  23:59            25.102 panels.module
22.07.2006  06:36               176 panels_admin.css
26.07.2006  18:53             1.171 README.txt
26.07.2006  18:53               237 TODO.txt
               8 Datei(en)         51.380 Bytes

 Verzeichnis von C:\Inetpub\wwwroot\drupal\modules\panels\content_types

03.08.2006  23:48    <DIR>          .
03.08.2006  23:48    <DIR>          ..
22.07.2006  06:36             3.552 block.inc
22.07.2006  06:36             2.533 custom.inc
22.07.2006  23:59             2.875 node.inc
24.07.2006  07:44             4.260 views.inc
               4 Datei(en)         13.220 Bytes

 Verzeichnis von C:\Inetpub\wwwroot\drupal\modules\panels\images

03.08.2006  23:48    <DIR>          .
03.08.2006  23:48    <DIR>          ..
22.07.2006  06:36                62 blank.gif
22.07.2006  06:36               687 go-bottom.png
22.07.2006  06:36               680 go-down.png
22.07.2006  06:36               653 go-top.png
22.07.2006  06:36               644 go-up.png
22.07.2006  06:56            14.072 screenshot-1.jpg
22.07.2006  06:56            43.830 screenshot-2.jpg
22.07.2006  06:56            43.224 screenshot-3.jpg
22.07.2006  06:56            73.474 screenshot-4.jpg
22.07.2006  06:36               655 user-trash.png
              10 Datei(en)        177.981 Bytes

 Verzeichnis von C:\Inetpub\wwwroot\drupal\modules\panels\layouts

03.08.2006  23:48    <DIR>          .
03.08.2006  23:48    <DIR>          ..
25.07.2006  01:56               318 threecol_25_50_25.css
26.07.2006  18:53             1.026 threecol_25_50_25.inc
22.07.2006  06:36               200 threecol_25_50_25.png
25.07.2006  01:56               563 threecol_25_50_25_stacked.css
26.07.2006  18:53             1.369 threecol_25_50_25_stacked.inc
22.07.2006  06:36               208 threecol_25_50_25_stacked.png
25.07.2006  01:56               415 threecol_33_34_33.css
26.07.2006  18:53             1.106 threecol_33_34_33.inc
22.07.2006  06:36               196 threecol_33_34_33.png
25.07.2006  01:56               584 threecol_33_34_33_stacked.css
26.07.2006  18:53             1.372 threecol_33_34_33_stacked.inc
22.07.2006  06:36               208 threecol_33_34_33_stacked.png
25.07.2006  01:56               330 twocol.css
26.07.2006  18:53               932 twocol.inc
22.07.2006  06:36               193 twocol.png
25.07.2006  01:56               485 twocol_stacked.css
26.07.2006  18:53             1.198 twocol_stacked.inc
22.07.2006  06:36               202 twocol_stacked.png
              18 Datei(en)         10.905 Bytes

serving’s picture

I am using 7.3 and a fresh CVS panels install.

I am getting the same error. I installed buy wget and tar zxvf in the modules dir like I usually do. The dir structure seems ok..

Module does not work still.

Serving

merlinofchaos’s picture

I just committed code that I think will fix this.

You can quickly test this by changing line 745 of panels.module to:

    require_once('./' . $file->filename);
rl’s picture

Title: Invalid argument supplied for foreach() - line 695 » Problem with module microcontent when using panel, Invalid argument supplied for foreach() - line 695

I just downloaded the latest panel from Drupal today.

I get the following error when I try to create a panel page. The version of microcontent is from 8/28 GMT.

My error is
warning: Invalid argument supplied for foreach() in /home/pittsfor/public_html/modules/microcontent/microcontent.module on line 241.

Of course, disabling microcontent makes the error go away. I have not done anything with microcontent except enable it.

Rich
(rl)

newms’s picture

Hi Merlin,
I am still getting the same warning, even with the update. The warning says:

warning: Invalid argument supplied for foreach() in /var/www/html/mydrupal/modules/panels/panels.module on line 696.

Am I doing something wrong? The directories are in the correct place.

Thanks,
Sean

merlinofchaos’s picture

Title: Problem with module microcontent when using panel, Invalid argument supplied for foreach() - line 695 » Invalid argument supplied for foreach() - line 695

rl, Please don't take over issues with new problems.

The microcontent issue may or may not be related, but it wasn't in the original reports, and the error you show is completely different. And I don't know anything about the microcontent.module -- since that's the module that's giving the error, you should file an issue against microcontent (and possibly a separate issue against panels and post links from each issue to the other so that we can cross reference).

newms: Argh. I don't know why you're having that problem. :/ I'll look into it further. It's difficult because I can't reproduce it so I can only take guesses as to why it fails for you.

Are you using PHP5?

newms’s picture

No I'm using PHP 4.3.9.

newms’s picture

I found out what the problem was. I was entering content on the panels in node form, e.g node/3 rather than the title of the page or the NID.

Thanks for your efforts Merlin.

marc.bau’s picture

yes, i'm using PHP 5.1.0.0

marc.bau’s picture

As a short note - the fix

require_once('./' . $file->filename);

seems working here! I will do more testing and come back then!

The microcontent issue is a microcontent module issue and not this issue, but asside i have this microcontent, too.

merlinofchaos’s picture

Status: Active » Fixed

Ok, there are so many different people getting errors in this issue, and some are fixed and some are not.

If there are still existing errors -- and I believe there are -- please file new issues so I can keep track of what's going on?

newms: Could you please file a separate bug about the node/3 input giving that error? It should give a much more meaningful error with that input.

Thanks!

Anonymous’s picture

Status: Fixed » Closed (fixed)
knubbe’s picture

Status: Closed (fixed) » Active

I can confirm this bug.
I'm using Drupal 5 (RC 2).
Panel version: // $Id: panels.module,v 1.10 2006/10/31 23:49:58 merlinofchaos Exp $
"warning: Invalid argument supplied for foreach() in /path/to/modules/panels.module on line 697."

On line 497: "foreach ($panels->content as $location => $list)" there's no check first if $panels-content is an array or not, so if there's no content added PHP will output a warning, since $panels->content isn't an array.

Two possible fixes:
1) turn off warnings in php.ini (ugly fix)
2) add a check in panels.module

Replace:
foreach ($panels->content as $location => $list) {
foreach ($list as $area) {
$function = $content_types[$area->type]['callback'];
if (function_exists($function)) {
$content[$area->area] .= $function($area->configuration);
}
}
}

With:
if (is_array($panels->content)) { // this line is new
foreach ($panels->content as $location => $list) {
foreach ($list as $area) {
$function = $content_types[$area->type]['callback'];
if (function_exists($function)) {
$content[$area->area] .= $function($area->configuration);
}
}
}
} // this line is new too

Cheers

merlinofchaos’s picture

Status: Active » Fixed

The error you mention (which btw was opened in a separate issue, as I instructed when I marked the issue fixed) is fixed in Panels 1.1

Anonymous’s picture

Status: Fixed » Closed (fixed)