Skip to content

Fix PHP warning on is_cloudinary_url method#1148

Merged
gabrielcld2 merged 1 commit intodevelopfrom
remove-php-warning
Feb 12, 2026
Merged

Fix PHP warning on is_cloudinary_url method#1148
gabrielcld2 merged 1 commit intodevelopfrom
remove-php-warning

Conversation

@gabrielcld2
Copy link
Collaborator

Fixes #1146

Approach

  • Verify the host part of the URL being checked is set
  • This prevents any PHP warning being emitted for a few specific URL formats

QA notes

  • Turn on WP debug logging by adding the following to your wp-config.php:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
  • Add the following one-liner to either your theme, or within a plugin:
add_action( 'admin_init', fn() => \Cloudinary\get_plugin_instance()->get_component( 'media' )->is_cloudinary_url( 'mailto:test@example.com' ) );
  • Open the WP admin in your browser
    • without this fix, your wp-content/debug.log file should contain a warning like this one: PHP Warning: Undefined array key "host"
    • with this fix, the warning should be gone

@gabrielcld2 gabrielcld2 changed the base branch from master to develop February 12, 2026 14:44
@gabrielcld2 gabrielcld2 merged commit 506feb9 into develop Feb 12, 2026
5 checks passed
This was referenced Feb 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PHP Warning: Undefined array key "host" in class-media.php line 1984

2 participants