selective-php / image-type

Image type (format) detection for PHP
MIT License
7 stars 4 forks source link

Consider closing file handler after using SplFileObject and SplFileInfo #6

Closed peter279k closed 5 years ago

peter279k commented 5 years ago

As title, it seems that the SplFileObject and SplFileInfo will let them be null after using them are done.

It seems that the ImageTypeDetector class uses the unset to release the SplFileObject variable.

But the SplFileInfo variable does not in ImageTypeDetectorTest class.

BTW, using the unset or assigning null is same as closing file handler.

Which one we prefer using in this repository?

odan commented 5 years ago

There is a good explaination on SO.

In a nutshell

I've used unset because I really don't need the variable anymore and I wanted to clean up everything.

Within a test it does't really matter, because the PHP garbage collector will clean it up anyway.

peter279k commented 5 years ago

Closed via current explanation :).