From 4027ecee5a3f6251110a66bcb9221d08c994ad5f Mon Sep 17 00:00:00 2001 From: Matt Pass Date: Sun, 16 Sep 2012 10:24:02 +0100 Subject: [PATCH] Use strpos instead of strstr Instead of just finding our dirname within the finalArray using strstr, now using strpos and detecting if it's pos 0, which is much more appropriate & reliable. Example: Looking for /bob/t1.txt for may potentially return a false positive for finding '/bob' in '/another/bob1/abc' and files therefore t1.txt ends up in the wrong folder. This false positive only occurs when the write order of hard drive storage has stored another/bob1/abc before /bob and therefore retrieval load order can cause this odd, occasional issue. Checking for /bob being the start of our finalArray item through strpos===0 eliminates this possibility. --- files.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files.php b/files.php index 955800d..626b5a2 100644 --- a/files.php +++ b/files.php @@ -66,7 +66,7 @@ for ($i=0;$i