Bug Description
Error:
PHP Warning: Undefined array key "host" in /wp-content/plugins/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-media.php on line 1984
Root Cause:
The is_cloudinary_url() method accesses $test_parts['host'] without checking if it exists. This happens when relative URLs (e.g., /wp-json/wp/v2/...) are passed to the method.
Current Code (line 1984):
return isset( $test_parts['path'] ) && false !== strpos( $test_parts['host'], $cld_url );
Proposed Fix:
return isset( $test_parts['path'] ) && isset( $test_parts['host'] ) && false !== strpos( $test_parts['host'], $cld_url );
Impact:
- Non-fatal warning
- Clutters error logs
- Occurs when REST API endpoints or other code validate relative URLs
Environment:
Plugin Version: 3.3.1
PHP Version: 8.5.1 (reproducible on PHP 8.2+)
WordPress: Latest (VIP Go)