Not sure if this is the same issue you experienced but I was using a Relationship field, and when it was blank I was getting the “Notice: Uninitialized string offset: 0” message.
I changed the name of the variable “$posts” to something else, and now it all seems to work correctly.