Bug #37701
closed
t3lib_div::getAllFilesAndFoldersInPath no md5 for folders
Added by Kay Strobach about 12 years ago.
Updated almost 7 years ago.
Description
if ($regDirs) {
$fileArr[] = $path;
}
should be
if ($regDirs) {
$fileArr[md5($path)] = $path;
}
analog to t3lib_div::getFilesInDir
related to: 6.0, 4.7, 4.6, 4.5 and earlier
- Status changed from New to Needs Feedback
- % Done changed from 50 to 0
- Complexity deleted (
no-brainer)
Are you sure that it
1. is necessary (is something broken?)
2. doesn't break anything (t3lib_div::getFilesInDire() mentions that the md5-hash-keys must never be changed because import/export depends on them; will anything depend on numerical keys for directories?)
hi,
as i read the function description everything should have a md5 hash (every path).
I use that functionality for a secure download extension (EXT:folder) (it depends on correct md5 hashes). The numbered keys for directories are simply inconsistent.
If somebody used something like:
intval($key) == $key
to decide wether an item is a file or not (haha), this may break this check, if not everything should be fine ;)
i forgot to mention, that i have a small function, that fixes this bug for me - but i wanted to report it, to get it solved for everybody ;)
- Status changed from Needs Feedback to Accepted
- TYPO3 Version changed from 4.5 to 6.0
- Complexity set to easy
I did a search for usages of getAllFilesAndFoldersInPath() in the core and nowhere the key is actually used.
I guess we can implement it as a feature (with some documentation perhaps about possible breaking things?)
By the way, it may come as a surprise to you but
intval($key) == $key
will be TRUE for any number or string B-)
Will you submit a patch (then you can assign it to yourself)?
i'll make a patch
target version = 6.0 - correct?
intval('34a') = 34 != 34a
intval('a23') = 0 != a23
intval('2a3') = 2 != 2a3
So where is the problem? ;)
intval() produces an integer. If you do a non-strict comparison with a non-numerical value PHP will convert it to a number.
So, it's not actually any value for which it will be TRUE, but only for values which would evaluate to an integer number or no number at all (and become zero).
intval('a23') == 'a23' -> TRUE
About the target version, yes 6.0 would be correct IMO. It changes the return value of the function, so it's kind of a breaking change which we won't like to have in existing releases.
- Target version set to 7.1 (Cleanup)
- Is Regression set to No
- Sprint Focus set to On Location Sprint
- Status changed from Accepted to In Progress
- Assignee set to Jan Helke
- Assignee changed from Jan Helke to Mateusz Wojtuła
- Status changed from In Progress to Under Review
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
- Sprint Focus deleted (
On Location Sprint)
- Status changed from Resolved to Closed
Also available in: Atom
PDF