[wp-trac] [WordPress Trac] #54331: Add a hook in wp_http_validate_url to control which ports are allowed for remote requests

WordPress Trac noreply at wordpress.org
Tue Nov 9 22:58:54 UTC 2021


#54331: Add a hook in wp_http_validate_url to control which ports are allowed for
remote requests
-------------------------------------------------+-------------------------
 Reporter:  xknown                               |       Owner:
                                                 |  hellofromTonya
     Type:  enhancement                          |      Status:  closed
 Priority:  normal                               |   Milestone:  5.9
Component:  HTTP API                             |     Version:
 Severity:  normal                               |  Resolution:  fixed
 Keywords:  good-first-bug has-patch has-unit-   |     Focuses:
  tests commit needs-dev-note                    |
-------------------------------------------------+-------------------------

Comment (by hellofromTonya):

 In [changeset:"52085" 52085]:
 {{{
 #!CommitTicketReference repository="" revision="52085"
 HTTP API: Ensure value returned from `'http_allowed_safe_ports'` is an
 array to avoid PHP 8+ TypeError fatal error.

 Adds an `is_array()` check before the `in_array()`. Why? `in_array()`
 requires a array for the haystack. Any other data type will cause a fatal
 error on PHP 8.0 or higher:

 {{{
 Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must
 be of type array
 }}}

 As this is a new filter, this type check properly guards to avoid the
 fatal error.

 Follow-up to [52084].

 See #54331.
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/54331#comment:21>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list