S3-Uploads
S3-Uploads copied to clipboard
fix readdir bug from PHP 8 substr change
As of PHP 8.0, substr will return empty string rather than false in certain circumstances.
From https://www.php.net/manual/en/function.substr.php : 8.0.0 The function returns an empty string where it previously returned false.
Due to this change, this implementation of readdir in S3-Uploads behaves incorrectly. In particular, this common pattern: while (($file = readdir($dh)) !== false){ which is used in gravityforms, becomes an infinite loop since the while loop just keeps getting an empty string rather than false.
This can lead to a crazy high AWS S3 list line item on your monthly bill. I recommend merging in this change right away to avoid this situation.