[TYPO3-core] RFC #12128: Performance improvement in t3lib_div::get_dirs()

Dan Osipov dosipov at phillyburbs.com
Mon Oct 5 19:40:07 CEST 2009


<snip>
$d = dir($path);
if (is_object($d)) {
</snip>

$d is checked to be an object, and if the first line failed, the rest 
will not execute.
This was previously mentioned on this list - the @ warning suppression 
was required with old PHP versions, but newer versions don't throw such 
warnings anymore.

If you can reproduce a warning, then I'll be happy to insert the @ 
symbol back.

Another option to make it backwards compatible is use a try/catch block, 
and utilize the new Exception handler.

Dan Osipov
Calkins Media
http://danosipov.com/blog/

Ernesto Baschny [cron IT] wrote:
> Hi,
> 
> why was the warning output being ignored before? The current API simply
> outputs nothing on "incorrect" $path parameter. With you change,
> warnings might show up where they haven't been before.
> 
> So I guess this is not really a solution we can add while we have to
> maintain some backwards compatibility. There has to at least be a check
> if the $path being scanned is really present and a valid directory
> before starting. This refers to the first @dir.
> 
> The @ before is_dir is of most probably not required, because is_dir
> should never spit out a warning, it just returns TRUE or FALSE. So this
> can be safely be removed. Although there have been reports on it giving
> out warnings when provided with a huge .iso or .zip file as an argument,
> but these are quite old and I couldn't reproduce.
> 
> Cheers,
> Ernesto
> 
> Dan Osipov schrieb:
>> This is an SVN patch request.
>>
>> Type: Feature
>>
>> Bugtracker references:
>> http://bugs.typo3.org/view.php?id=12128
>>
>> Branch: Trunk
>>
>> Problem:
>> @ symbols are used in the function. They can be removed to improve
>> performance. Performance improvement with the patch is about 5%.
>>
>> I also took the liberty to apply CGL to the function - but if someone
>> can do a better job, feel free.
>>


More information about the TYPO3-team-core mailing list