This question already has an answer here:
For example, this answer (which I've deleted) to What happens when you cast Fog Cloud behind a wall?, but this isn't the only case.
The question originally asked about Create Bonfire, not Fog Cloud - however, the details of the Create Bonfire spell gave a much simpler solution to the more theoretical rules question the asker had in mind.
Now that the question has been changed, my answer is not useful. Normally, I'd edit my answer to address the new question, but I don't have anything to add that isn't already stated in both of the answers currently rated above it.
I deleted my answer since it was now no more useful than a comment, but that feels abit strange. Was that the right thing to do in this case?