After enabling CCK, Views and Panels 2.0 Alpha 7, I went and added a new panel. I added the "frontpage" view to the right column with the title "News" just to test out Alpha 7, and I got the following warnings:
* warning: natcasesort() [function.natcasesort]: The argument should be an array in C:\Apache2\htdocs\shared\sandbox\sites\all\modules\panels\panels.module on line 849.
* warning: Invalid argument supplied for foreach() in C:\Apache2\htdocs\shared\sandbox\sites\all\modules\panels\panels.module on line 850.
* warning: natcasesort() [function.natcasesort]: The argument should be an array in C:\Apache2\htdocs\shared\sandbox\sites\all\modules\panels\panels.module on line 849.
* warning: Invalid argument supplied for foreach() in C:\Apache2\htdocs\shared\sandbox\sites\all\modules\panels\panels.module on line 850.
* warning: natcasesort() [function.natcasesort]: The argument should be an array in C:\Apache2\htdocs\shared\sandbox\sites\all\modules\panels\panels.module on line 849.
* warning: Invalid argument supplied for foreach() in C:\Apache2\htdocs\shared\sandbox\sites\all\modules\panels\panels.module on line 850.
I'm not entirely sure what's going on here.
Comments
Comment #1
robloachCould it be that the view had no content nodes in it when I created the panel? The panel still worked, I just got those strange warnings when creating it.
Comment #2
merlinofchaos commentedInteresting. That's the code that figures out the categories and indicates something is screwing up; that but shouldn't even be possible, since it's using data that's paired together just prior to the call. I've never seen anything like this, so I may need you to put in some debugging prior to that line to get an idea of what's happening.
IN fact, if you could do a dprint_r (or similar) of $titles and $weights just prior to the foreach that contains the natcasesort in panels.module and post the results here, that could be handy.
Comment #3
yoroy commentedI'm seeing the same warnings. On a fresh drupal 5.1 install, with Panels alpha7 being the only contrib module, on saving a first panels-page.
If this is about categories: there are none in this drupal install. Might that be a clue?
Comment #4
merlinofchaos commentedBy categories, I mean the categories it uses to sort the possible content types in the add content plugin.
Comment #5
yoroy commentedOh. I tried adding a print_r($weights) but then the add-content modal does not fully load (just the throbber staying there)
this is from panels.module, starting at line 848:
I'm horrible with PHP, so I have to ask is that the place I should put it?
To be specific: I get the warnings when saving after I added content to the panel.
Comment #6
robloachWhat if you did an is_array check before you pass it to natcasesort? I can't seem to replicate this error now....
Comment #7
merlinofchaos commentedyoroy: Try a drupal_set_message rather than a print_r. It can be difficult to get debug messages out of the modal. Here is what I do:
Open two tabs. On one tab, I open the modal; whenver it does an ajax call and a drupal_set_message gets called, I refresh the page in the other tab, and that shows me whatever got set.
I haven't seen this natcasesort bug come up again; I think I'd rather not 'fix' it the easy way by just defining an array as it should *never* be empty, and the fact that it is indicates a larger bug. Fixing the symptom could obscure a bigger problem.
Comment #8
yoroy commentedusing two open tabs in firefox learned me:
- the warnings already occur on opening the modal: I click the add-content icon in the first tab, refresh the second tab: errors given.
- Next: add some content in the modal, click [add pane], modal closes. A refresh in the second firefox tab: no errors shown.
I did this in panels.module, line 849 - 852:
This give me no extra output rendered to the screen… I'm probably doing something wrong…
Comment #9
merlinofchaos commentedYou need to put some kind of a message in drupal_set_message().
That'd be a good start.
Comment #10
yoroy commentedthat works, this is the drupal_set_message output when opening the modal:
Comment #11
robloachHit it again with Alpha 9....
Comment #12
merlinofchaos commentedI've fixed the symptom, which is to say that this error message will not appear anymore; however, I don't know what's actually *causing* the bug, so there may well still be something wrong here.
Comment #13
(not verified) commented