I have Magento v2.4.5-p1 and after php version upgrade to 8.1 when running the command: index:reindex i get this error for each index: flock(): supplied resource is not a valid stream resource.
Has anyone experienced this? How can I fix it?
I found a solution. Like this solution I have a third party extension that was causing me to get the error. Adding validation helped solve the problem.
As it was:
@flock($pointer, LOCK_UN);
@fclose($pointer);
My fix:
if (is_resource($pointer) && get_resource_type($pointer) == 'stream') {
@flock($pointer, LOCK_UN);
@fclose($pointer);
}