Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid argument supplied for foreach() in PatternLabListener.php on line 47 #1

Open
aleksip opened this issue Jul 4, 2016 · 17 comments
Labels

Comments

@aleksip
Copy link
Member

aleksip commented Jul 4, 2016

It looks like $patternData["lineages"] is false in some cases (happened to me with some pseudo patterns), and count(false) returns 1. So the if conditions on line 43 should probably be amended accordingly.

@dmolsen
Copy link
Member

dmolsen commented Jul 7, 2016

Have a blind fix for this in dev. If you could give me a use case I can replicate I'll dig into it more. I'll close once v1.0.1 goes out.

@dmolsen dmolsen self-assigned this Jul 7, 2016
@dmolsen dmolsen added the bug label Jul 7, 2016
@aleksip
Copy link
Member Author

aleksip commented Jul 15, 2016

I have now created a StarterKit that should demonstrate the bug. The fix in dev seems to work.

The StarterKit is also helpful in demonstrating other bugs, for example patternlab-php-core#16 and #2. Also, if you look at Pattern Partial Nodatafile there seems to be something odd going on with Data Inheritance Plugin...

@dmolsen
Copy link
Member

dmolsen commented Jul 15, 2016

Appreciate you putting that together. So I should be able to get by with dev of Core, DIP, and your StarterKit to demonstrate the issues? I really need to work on my naming skills so I don't end up with really dumb acronyms >.<

Tangent but I'm going to build an acid test StarterKit to hopefully catch these issues earlier on in the future. Or at least it'll demonstrate expected input/output. For example, Issue 16 may require an rethink of how I tackle data overall.

@aleksip
Copy link
Member Author

aleksip commented Jul 15, 2016

So I should be able to get by with dev of Core, DIP, and your StarterKit to demonstrate the issues?

I tested with the master branch of Standard Edition for Twig, the released version of DIP :) and the StarterKit. Also with DIP dev-dev.

Acid Test StarterKit sounds cool!

@dmolsen
Copy link
Member

dmolsen commented Jul 15, 2016

Well, I'm finding bugs with styleguidekit-assets-default so I guess that's good ;)

pattern-lab/styleguidekit-assets-default#34
pattern-lab/styleguidekit-assets-default#35

@dmolsen
Copy link
Member

dmolsen commented Jul 15, 2016

Really dumb question. How do I add paths to a fairly vanilla set-up? e.g. so @atoms is properly parsed?

@aleksip
Copy link
Member Author

aleksip commented Jul 15, 2016

Hmm, not sure if this is what you mean but there has been automatic support for top-level folders since Twig PatternEngine 0.7.2. A plugin is needed for anything else I think.

Didn't the test StarterKit Twig namespace includes work with your setup?

@dmolsen
Copy link
Member

dmolsen commented Jul 15, 2016

Not looking like it. I chalk up my forgetting that feature to the fact that I track a lot across PL ;) I'll double-check and see what I could have f'ed up.

@dmolsen
Copy link
Member

dmolsen commented Jul 15, 2016

@aleksip -

facepalm

Namespaces are working. Titles are the include tags wrapped in {% raw %} tags. Ignore me. Long week.

@nstriedinger
Copy link

nstriedinger commented Oct 31, 2016

I'm not sure if this is the correct place to post this question, but I'm also running into this issue. In Patternlab all my includes have been changed to twig template namespaces and now there is no lineage link The <strong>{{ patternName }}</strong> pattern contains the following patterns:

@therealpecus
Copy link

bump for interest. currently hitting this bug with basic inheritance

@aleksip
Copy link
Member Author

aleksip commented Feb 8, 2017

@nstriedinger @therealpecus You might want to try Data Transform Plugin. It has a slightly different implementation of data inheritance, but it might suit your needs. Using the other features of DTP is completely optional. The latest versions work with Twig PatternEngine only, but v0.10.2 should work with Mustache PatternEngine as well.

@therealpecus
Copy link

Thanks @aleksip , I'll give it a try!

@RedLucas
Copy link

Hey, I run into the exact same problem. Data transform doesn't really do what I want... This bug's been here for over a year eh? Does anyone know off-hand how big an issue this is? Like is it just a matter to type checking or does a bunch of this have to be rewritten? I could look at it too, I just... I don't really want to duplicate work here..

@aleksip
Copy link
Member Author

aleksip commented Jan 23, 2018

@nstriedinger @therealpecus @RedLucas I believe everything should now work using Twig PatternEngine v2.1.3. Can you confirm this?

@tanc
Copy link

tanc commented Feb 13, 2018

@aleksip I can confirm that using https://github.com/aleksip/plugin-data-transform works now with the latest Twig PatternEngine.

I've also tested this plugin but inheritance seems to only half work. I'm still seeing a couple of Invalid argument supplied for foreach() while other included patterns are loaded with their lineage data intact. I'm not going to test this plugin any further as the plugin-data-transform works well so I'll stick with that.

I'm very happy to have working lineage as it greatly simplifies Pattern Lab data management. Thanks for everyone's hard work on this!

@aleksip
Copy link
Member Author

aleksip commented Feb 13, 2018

@tanc Thanks, good to know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants