Issue Bug Closed

#47981opendir result not checked before calling readdir in class.t3lib_div.php

Fabrice Morin 05/06/13, 13:40 updated 10/02/18, 12:14

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

Reviews 2