Bug #47981
closed
opendir result not checked before calling readdir in class.t3lib_div.php
Added by Fabrice Morin over 11 years ago.
Updated about 6 years ago.
Description
In function fixPermissions, there is a call to opendir() in order to retrieve a handle passed to readdir(), but this handle is not checked and assumed to be an actual file handler.
This triggers an endless loop in apache error log :
PHP Warning: readdir() expects parameter 1 to be resource, boolean given in /data/www/omegawatches.com/watches/t3lib/class.t3lib_div.php on line 2823, referer: http://www.omegawatches.com/typo3/alt_doc.php?returnUrl=%2Ftypo3%2Fsysext%2Fcms%2Flayout%2Fdb_layout.php%3Fid%3D543&edit[pages_language_overlay][3310]=edit&overrideVals[pages_language_overlay][sys_language_uid]=8
Someone filed a bug for PHP here : https://bugs.php.net/bug.php?id=63205
But it was answered that the caller must check the validity of the parameters passed to PHP functions (i.e. readdir())
- Category set to Miscellaneous
- Status changed from New to Accepted
- Target version set to 6.2.0
- Complexity set to easy
The bug still exists in current master (6.2-dev).
- Subject changed from opendir result not checked before calling readding in class.t3lib_div.php to opendir result not checked before calling readdir in class.t3lib_div.php
- Target version deleted (
6.2.0)
- TYPO3 Version changed from 4.7 to 4.5
This can probably only happen if the actual directory being recursed into is not readable.
The code is unchanged since 4.5, so this does not need to target 6.2 in particular but all maintained stable releases.
The fix should include unit tests, because this method is already extensively covered by unit tests (see typo3/sysext/core/Tests/Unit/Utility/GeneralUtilityTest.php in post-6.0 releases and tests/t3lib/t3lib_divTest.php in older releases).
- Target version set to 7.1 (Cleanup)
- Is Regression set to No
- Target version changed from 7.1 (Cleanup) to 7.4 (Backend)
- Target version changed from 7.4 (Backend) to 7.5
- Target version deleted (
7.5)
- Status changed from Accepted to Under Review
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
- Status changed from Resolved to Closed
Also available in: Atom
PDF