[wp-trac] [WordPress Trac] #49385: wp_remote_get() cannot retrieve webcal URIs
WordPress Trac
noreply at wordpress.org
Fri Feb 7 18:40:13 UTC 2020
#49385: wp_remote_get() cannot retrieve webcal URIs
------------------------------------------+------------------------------
Reporter: johnjamesjacoby | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: HTTP API | Version:
Severity: normal | Resolution:
Keywords: needs-patch needs-unit-tests | Focuses:
------------------------------------------+------------------------------
Comment (by johnjamesjacoby):
This bug exists because PHPs `parse_url()` function apparently does not
consider `webcal` a valid scheme, even though WordPress does.
Inside `WP_Http::request()`, `parse_url()` is used on the `webcal://` url,
which does not return a scheme.
`$arrURL['scheme']` ends up being empty, and a `WP_Error()` is returned.
----
Oddly, if you attempt to use `parse_url()` with the `PHP_URL_SCHEME` flag,
it will correctly identify the webcal scheme:
{{{
add_action( 'plugins_loaded', function() {
// Public iCloud calendar I created
$uri = 'webcal://p41-caldav.icloud.com/published/2
/AAAAAAAAAAAAAAAAAAAAAF-eqSypTVlehAPwNTiPeHHBkTEvCi1qK6G4LDcU1Fr6AKLM-
yaJrbRrhSSGMrjSbAxJZJ6TibzOCKLh0xBSpKI';
// Regular remote get call
$scheme = parse_url( $uri, PHP_URL_SCHEME );
// Dump results
var_dump( $scheme ); die;
} );
}}}
No doubt this is an error/oddity in PHP's implementation of `parse_url()`,
but because WordPress made the decision to explicitly support it, I
believe there is an obligation to follow through with that where PHP
itself may be failing it.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/49385#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list