The use of function is_readable() is discouraged in Magento2

How to fix ... in Magento

Today I was working on method which is responsible to read information of an uploaded file. I came across the same problem I had in my previous blog post ( The use of function filectime() / filemtime() is discouraged in Magento2 ).

This time it was able to get rid of the warning quickly, because \Magento\Framework\Filesystem\Driver\File was already injected in my constructor.

I simply replaced is_readable with the below condition.

That’s it. Check my blog post about Working with files and folders in Magento2 for more information.

Leave a Reply

Your email address will not be published. Required fields are marked *