[TYPO3-core] Gremlin #76: t3lib_div::writeFile() changespermissions without need

Michael Stucki michael at typo3.org
Wed Oct 26 22:59:56 CEST 2005


Hi Martin,

>> Check if the file exists, set a flag, and only change the permissions
>> if this flag was set.
> 
> Note: you don't check for existence, but test if path points to a file.
> But it won't matter as fopen wil fail on directories, etc.

Notice the name of that function: writeFile. The function does only make
sense with files, so it's ok if the operation will fail on directories!

> As for the test condition: I thought that the guidelines require bracktes
> even for one liners:
> 
> if (!@is_file($file)) {
> $changePermissions=true;
> }

I think you can write it on one line but need brackets except for return
statements.

This is not written in the coding guidelines, it's just what I've noticed by
reading the source code.

Anyway, you're right in this case. I will change it.

> Otherwise +1

Fine. Only two more eyes needed... :-)

- michael
-- 
Use a newsreader! Check out
http://typo3.org/community/mailing-lists/use-a-news-reader/



More information about the TYPO3-team-core mailing list