Finfo Moved Away From Resource

Finfo functions have moved from resource to objects in PHP 8.1. Instead of returning a resource, it now returns a finfo object. Checks based on is_resource() must be upgraded, and are now dead code.

PHP code

<?php

var_dump(finfo_open());

?>

Before

resource(4) of type (file_info)

After

object(finfo)#1 (0) {
}

PHP version change

This behavior changed in 8.1

See Also