Please add a comment explaining why foreach (which would be prefered over while) is not used. Make sure to link to the bug ticket in question, i.e. ttps://github.com/owncloud/core/issues/8376