Repository navigation
Always check variable type before using readdir to avoid surprises - #4719
Conversation
|
👍 |
|
Test passed. |
|
Hmm, aren't there iterators that could be used instead of the old-fashioned readdir stuff? |
|
Like http://php.net/manual/en/class.directoryiterator.php? Would be certainly more modern and would probably fix the issues, too. But I'd prefer to get this as is into master to make sure the bugs fixed in #4701 are also dealt with on master. Then it may be switched to Iterators, if it really gives us a benefit. |
There was a problem hiding this comment.
|
@blizzz Yes. |
|
@bantu so, do you give me a thumb? 🐱 |
|
@blizzz @schiesbn there is one readdir in \OCA\Encryption\Util::findEncFiles() where no is_resource() call has been inserted - can you please double check? THX |
|
\OC_Mount_Config::getCertificates() as well |
|
OC\Files\Storage\Shared::filemtime |
|
\OC_Helper:chmodr() @icewind1991 maybe you can help out here as well - thx |
|
Your're right, I only checked the changes from c5402f4 |
|
Hint: to hide the whitespace changes in the util.php add "?w=0" to the url, or click https://github.com/owncloud/core/pull/4719/files?w=0 |
|
Test passed. |
opendir() happens in the if statement which should be equivalent to the is_resource() check, see core/apps/files_encryption/lib/util.php Line 330 in c01675d Now we check twice if opendir() was successful. I would suggest to either remove the is_resource check again or maybe better for readability, move |
|
👍 |
|
Thanks for fixing this! |
Always check variable type before using readdir to avoid surprises
Port of #4701, with few adjustments according to master.
@bartv2 @icewind1991 @karlitschek or others please.