owncloud/core — pull request #4701 by blizzz (2013-09-02 17:04:49+00:00)
Title: Always check variable type before using readdir to avoid surprises, fixes #4667 #4658 and #4613

[Readdir](http://php.net/manual/en/function.readdir.php) is said to return false if a folder could not be opened, but if the provided variable is not a proper parameter null is passed. Because since https://github.com/owncloud/core/commit/f42b69d72fd456c32380b46af38eab9ef339e141 we are (correctly!) strictly checking for a false, we can end up in an infinite loop that kills the web server, as reported in #4667 #4658 and #4613

please review @icewind1991 @karlitschek @schiesbn or others

P.S.: includes also fix a wrong var name.