Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fix possible undefined warning with parsed site url #22

Merged
merged 1 commit into from

3 participants

@jeremyfelt

If parse_url() does not return a path key, the check for the value of path can cause a warning in PHP.

Check to see that the path key exists before trying to compare it.

Fixes #21

@jeremyfelt jeremyfelt Fix possible undefined warning with parsed site url
If parse_url() does not return a path key, the check for the value of path can cause a warning in PHP.

Check to see that the path key exists before trying to compare it.
f157bf0
@danielbachhuber danielbachhuber merged commit ba6427d into tlovett1:master
@tlovett1
Owner

Thanks Jeremy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 18, 2012
  1. @jeremyfelt

    Fix possible undefined warning with parsed site url

    jeremyfelt authored
    If parse_url() does not return a path key, the check for the value of path can cause a warning in PHP.
    
    Check to see that the path key exists before trying to compare it.
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 1 deletion.
  1. +1 −1  safe-redirect-manager.php
View
2  safe-redirect-manager.php
@@ -703,7 +703,7 @@ public function action_parse_request() {
* the pre-WP path off the requested path.
*/
$parsed_site_url = parse_url( site_url() );
- if ( '/' != $parsed_site_url['path'] ) {
+ if ( isset( $parsed_site_url['path'] ) && '/' != $parsed_site_url['path'] ) {
$requested_path = preg_replace( '@' . $parsed_site_url['path'] . '@i', '', $requested_path, 1 );
}
Something went wrong with that request. Please try again.