fix: harden url mapping validation

This commit is contained in:
Keith Solomon
2026-04-26 14:34:44 -05:00
parent 8d7abc8536
commit 4880613b67
4 changed files with 95 additions and 6 deletions
+13
View File
@@ -125,6 +125,19 @@ if ( ! function_exists( 'esc_url_raw' ) ) {
}
}
if ( ! function_exists( 'wp_parse_url' ) ) {
/**
* Minimal URL parser for unit tests.
*
* @param string $url URL to parse.
* @return array<string, mixed>|false
*/
function wp_parse_url( $url ) {
// phpcs:ignore WordPress.WP.AlternativeFunctions.parse_url_parse_url -- Test stub for WordPress' wp_parse_url().
return parse_url( $url );
}
}
if ( ! function_exists( 'get_option' ) ) {
/**
* Minimal WordPress option reader for unit tests.