Project

General

Profile

Actions

Bug #37701

closed

t3lib_div::getAllFilesAndFoldersInPath no md5 for folders

Added by Kay Strobach almost 12 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Should have
Category:
-
Target version:
Start date:
2012-06-02
Due date:
% Done:

100%

Estimated time:
0.20 h
TYPO3 Version:
6.0
PHP Version:
5.3
Tags:
Complexity:
easy
Is Regression:
No
Sprint Focus:

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

Actions #1

Updated by Jigal van Hemert almost 12 years ago

  • 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?)

Actions #2

Updated by Kay Strobach almost 12 years ago

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 ;)

Actions #3

Updated by Kay Strobach almost 12 years ago

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 ;)

Actions #4

Updated by Jigal van Hemert almost 12 years ago

  • 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)?

Actions #5

Updated by Kay Strobach almost 12 years ago

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? ;)

Actions #6

Updated by Jigal van Hemert almost 12 years ago

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.

Actions #7

Updated by Frans Saris over 9 years ago

  • Target version set to 7.1 (Cleanup)
  • Is Regression set to No
  • Sprint Focus set to On Location Sprint
Actions #8

Updated by Jan Helke about 9 years ago

  • Status changed from Accepted to In Progress
  • Assignee set to Jan Helke
Actions #9

Updated by Jan Helke about 9 years ago

  • Assignee changed from Jan Helke to Mateusz Wojtuła
Actions #10

Updated by Mateusz Wojtuła about 9 years ago

  • Status changed from In Progress to Under Review
Actions #11

Updated by Mateusz Wojtuła about 9 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #12

Updated by Anja Leichsenring over 8 years ago

  • Sprint Focus deleted (On Location Sprint)
Actions #13

Updated by Riccardo De Contardi over 6 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF