deliciousbrains / wp-amazon-s3-and-cloudfront

Automatically copies media uploads to Amazon S3 for delivery. Optionally configure Amazon CloudFront for even faster delivery.
https://wordpress.org/plugins/amazon-s3-and-cloudfront/
312 stars 150 forks source link

PHP8.1 deprecation notices #627

Closed viktorhaid closed 1 year ago

viktorhaid commented 1 year ago

Hi there, when upgrading our sites to PHP 8.1 we see the following deprecation notices:

PHP message: PHP Deprecated:  substr_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /var/www/html/web/app/plugins/amazon-s3-and-cloudfront/classes/as3cf-filter.php on line 951
PHP message: PHP Deprecated:  strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/html/web/app/plugins/amazon-s3-and-cloudfront/classes/as3cf-filter.php on line 951

Would be cool to have them fixed in upcoming patch releases.

ianmjones commented 1 year ago

Hey @viktorhaid,

Please can you post the Diagnostic Info for the site where you're seeing this message?

That 2nd param to substr_replace() shouldn't ever be null, so there's something in your site's config that is tripping things up that we'd love to figure out.

viktorhaid commented 1 year ago

Hi @ianmjones, thanks for the hint, that it shouldn't ever be null.

After debugging i've found the misconfiguration on our site: WP_HOME wasn't set here, as we change it afterwards (dynamically) in our setup. Resulted in having just the relative path in $base_url and $orig_domain were therefore null here.

Offloading and fetching the uploads worked nevertheless, so we haven't noticed it before.

Thanks for your willingness to help! I appreciate it! 👌