WordPress.org

Support

Support » Plugins and Hacks » [Resolved] 1.0 beta "Warning: Invalid argument supplied for foreach()…"

[Resolved] 1.0 beta "Warning: Invalid argument supplied for foreach()…"

  • bradman334
    Member

    @bradman334

    I have just installed the beta and when I open WP Tiles I get the following warning:

    `Warning: Invalid argument supplied for foreach() in /home/me/mysite/wp-content/plugins/wp-tiles/src/WPTiles/Admin/DataSources.php on line 85

    Given it is a warning I presume it should be safe to continue using it. For now I will not be using it on any live pages.

    PS. thanks for what looks like a great plugin, I am excited to put it through its paces.

    https://wordpress.org/plugins/wp-tiles/

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author Mike Martel
    Participant

    @mike_cowobo

    Hi bradman334,

    Thanks for reporting this!

    Found the problem there. The warning is indeed harmless – the source is the list of additional image sizes in the admin screens of WP Tiles, which is empty in your case. In the next update I’ll take care of the warning.

    Cheers,
    Mike

    bradman334
    Member

    @bradman334

    Hi Mike,

    No problem. After looking at the code I could see it wasn’t going to do anything so just commented it out for now.

    Cheers
    Steve

    sugarandbloom
    Member

    @sugarandbloom

    Hi Mike,

    I got the same problem as well. “Warning: Invalid argument supplied for foreach()…”

    I also can’t save default settings in the WP Tiles settings pages (ie. … wp-admin/admin.php?page=wp-tiles#_Tiles).

    Do you think this is a related problem? Or – if it is something different, any idea how I fix it?

    BTW – plug in looks great… how long till it goes production and out of beta?

    Cheers,
    S&B

    sugarandbloom
    Member

    @sugarandbloom

    … It just gets stuck on “saving now”. Cheers

    Plugin Author Mike Martel
    Participant

    @mike_cowobo

    Hi @sugarandbloom,

    Thanks of reporting that!

    I have now updated the development version on WordPress.org to also have this bug fixed. Saving settings and resetting to defaults works on my test install, so my best guess is currently that the warning message messes with the ajax response there. Can you try the new version and confirm if you can save the defaults again?

    Thanks!

    Mike

    sugarandbloom
    Member

    @sugarandbloom

    Hi Mike,

    Sorry for the slow response.

    I updated to your new development version and that got rid of the error and allowed me to save changes… Thanks!

    I am having a different challenge now… (probably “user” error). When I use the short code to set the ‘Grids’ (eg. grids=”Simple”) it is fairly problematic. Seems to only pick up the same grid template every time (aa|.. which might be News or Default). I noticed that in the grid templates section there was one template with no name (maybe ‘default’) and 6 templates with the same name (ie. ‘News’). Was wondering if this was causing it or if anyone else has experienced similar bugs?

    Cheers,
    SugarandBloom

    Plugin Author Mike Martel
    Participant

    @mike_cowobo

    Hi again,

    Somebody did report something similar the other day, but I didn’t get any feedback yet (see: http://wordpress.org/support/topic/10-beta-byline-template-opengraph-meta-not-working?replies=4#post-5677415 ).

    What you’re describing is very interesting.. I assume you updated from a pre 1.0 version? In that case the conversion script did not do its work properly (exactly the reason why I’m holding back then 1.0 a little while!).

    Could you please check the following:

    • What is the layout of the grid with no name? If it’s not a layout you set in the previous version, just put the whole layout in here, then I’ll figure out where it’s from
    • The layouts called ‘News’, are they all the same, or is only the title the same?
    • Is the layout that is always picked up the one with no name? You can test this out by setting a recognizable layout for the one with no name and checking the rendered page.
    • I’m sorry if these steps take some time. I’d really like to find out what the problem is so I can make sure it doesn’t occur for other users when I release the 1.0!

      Thanks,
      Mike

    sugarandbloom
    Member

    @sugarandbloom

    Hi Mike,

    Thanks for your response again!

    Yes – we had updated from 0.61… But we completed deleted the wp-tiles folder from /content/plugins first.

    Answers to your questions…

    1) Layout of the grid with no name

    AA
    ..
    AA
    ..
    AA
    ..
    AA

    2) Layouts called news

    All News grids have the same layout.. There are 6 of them in total
    1 has modified date of 20 Jun, other 5 have modified date of 23 May
    I may have modified the 20 Jun trying to get it working

    AABB.
    AA.CC
    .DDEE
    FF.EE

    In terms of what I have tried…
    * Deleting all the News grids
    * Giving the grid with no name a title (eg. Default)
    * Creating new grids
    * Creating manual grids in the short code (eg. using Grid=”AAA|…|BBB|…|”)

    The results of changing things aren’t very consistent: eg.
    * Set grid to Condensed (Layout = ……..) and it works
    * Go and change the Condensed grid layout in settings to something else (Layout = ….)
    * Try to preview again and suddenly it goes back to a default AA..BB.. layout

    Probably user error – I hope not… don’t want to waste your time chasing a gremlin in the machine if it just my mistake.

    Cheers

    sugarandbloom
    Member

    @sugarandbloom

    Oh – and also… I looked at the other post you referenced…

    What is the expected behaviour of setting Grids=”All”?

    When I did this is just went back to the AA..BB.. layout again.

    Cheers

    Plugin Author Mike Martel
    Participant

    @mike_cowobo

    Hi again,

    Thanks for taking the time to try everything out report back! I don’t have a solution yet, but I’ll post back here shortly when I know more.

    Thanks again and let me know if you run into anything else!

    Mike

    Plugin Author Mike Martel
    Participant

    @mike_cowobo

    Hi again @sugarandbloom!

    Sorry for not getting back to you sooner. I haven’t been able to reproduce this bug exactly, but I suspect the problem is that you’re stuck with the small screen template! The breakpoint is based on the width of the parent container of WP Tiles, not the screen. Have you tried setting the breakpoint to 0? Then you should hopefully get the grid you have specified for your tiles.

    As for the strange grids.. that’s definitely the code that converted from <1.0 to 1.0: the nameless template is the old mobile template and the news template are all new news templates – no idea why there are so many though! I’ll walk through the legacy code again to see what happened exactly.

    Lastly, when you set the grids parameter to all you should get the template selector above the grid. But again – that’s only above the breakpoint (so that’s another way of figuring out if that’s the case).

    Let me know if the breakpoint does the trick!

    Cheers,
    Mike

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘[Resolved] 1.0 beta "Warning: Invalid argument supplied for foreach()…"’ is closed to new replies.