Make WordPress Core

Opened 12 years ago

Closed 12 years ago

#27684 closed defect (bug) (fixed)

wp_http_validate_url() - PHP Notice: undefined index port

Reported by: jesin Owned by: SergeyBiryukov
Priority: normal Milestone: 3.9
Component: HTTP API Version: 3.5.1
Severity: normal Keywords: has-patch commit
Cc: Focuses:

Description

If the URL of my WordPress site is http://example.com/ and I pass the same URL with a port number which is NOT 80, 443 or 8080 to the wp_http_validate_url() function the following PHP notice is shown.

Notice:  Undefined index: port in /var/www/wp-includes/http.php on line 513

Code to reproduce the problem.

var_dump ( wp_http_validate_url( 'http://yoursite.com:81' ) );

Output:

Notice:  Undefined index: port in /var/www/wp-includes/http.php on line 513
bool(false)

Expected output:

bool(false)

Attachments (1)

27684.diff (480 bytes ) - added by jesin 12 years ago.
Check if index port is set before comparing

Download all attachments as: .zip

Change History (4)

@jesin
12 years ago

Check if index port is set before comparing

#1 @jesin
12 years ago

  • Keywords has-patch added

#2 @SergeyBiryukov
12 years ago

  • Keywords commit added
  • Milestone Awaiting Review3.9
  • Version 3.8.13.5.1

Introduced in [23329], moved to wp_http_validate_url() in [24480].

#3 @SergeyBiryukov
12 years ago

  • Owner set to SergeyBiryukov
  • Resolutionfixed
  • Status newclosed

In 27953:

Avoid an undefined index notice in wp_http_validate_url().

props jesin.
fixes #27684.

Note: See TracTickets for help on using tickets.