[wp-trac] [WordPress Trac] #36356: Function signature of wp_parse_url() does not match parse_url()

WordPress Trac noreply at wordpress.org
Fri Sep 30 21:14:45 UTC 2016


#36356: Function signature of wp_parse_url() does not match parse_url()
--------------------------------------+-----------------------------
 Reporter:  johnbillion               |       Owner:  SergeyBiryukov
     Type:  defect (bug)              |      Status:  reviewing
 Priority:  normal                    |   Milestone:  4.7
Component:  HTTP API                  |     Version:  4.4
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:
--------------------------------------+-----------------------------
Changes (by jrf):

 * keywords:  needs-unit-tests needs-patch => has-patch has-unit-tests


Comment:

 Ok, I've finally had some time to take another look at this, including the
 build failures.

 The patch I've just uploaded includes:
 * The original patch
 * The additional changes made by @johnbillion
 * A fix for the PHP 5.2 failure - or rather a code logic fix which will
 prevent the PHP 5.2 failure.

 The code logic change basically looks at what `$component` parameter was
 passed and for relative URLs bows out early if the `$component` is either
 scheme or host - which won't be available for relative URLs anyway.
 It also only removes the placeholders when the `$component` is the default
 `-1` as that's the only time the `$parts` array will actually be an array.

 Minor additional change: changed the `protected static $full_test_url` in
 the test file to a class constant.

 The change has been tested on PHP 5.2 - 7.1 and the unit tests pass.

 I've also had travis run the unit tests (just for the `http` group which
 is affected by this change) and the build passes there as well: https
 ://travis-ci.org/jrfnl/develop.wordpress/builds/164150049

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


More information about the wp-trac mailing list