php-gettext / Gettext

PHP library to collect and manipulate gettext (.po, .mo, .php, .json, etc)
MIT License
687 stars 132 forks source link

Update Scanner.php #254

Open vinodraut opened 4 years ago

vinodraut commented 4 years ago

handled generated notice on php 7.4 if its not file by by insuring it should be file, which further generate fatal error as fread returns false.

vinodraut commented 4 years ago

Thanks for your contribution but I think that if the value is not a file, it should throw an Exception, as it does in line 89.

You are right, but I have weird experience on PHP 7.4.3+ where some items creates a problem with error 21 and further execution gets stop. But with same Glob to work on same code it works fine on below 7.4.3.

As this function is to read the files, I think we should do it as precautionary so there should not break the functionality.

Thank you

oscarotero commented 4 years ago

What is the line that generates the code? filesize or fopen ?

If it's filesize maybe we can change this code to something more modern, without need to use filesize:

$content = stream_get_contents($fd);