[wp-trac] [WordPress Trac] #26947: IXR_Client strips query string from server URL

WordPress Trac noreply at wordpress.org
Mon Jan 27 04:06:36 UTC 2014


#26947: IXR_Client strips query string from server URL
--------------------------+-----------------------------
 Reporter:  cfinke        |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  XML-RPC       |    Version:  trunk
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 {{{IXR_Client}}} (and {{{WP_HTTP_IXR_Client}}}) has the option to pass the
 entire server URL as the first argument to the constructor, and it will
 parse out the path from the host:

 {{{
 if (!$path) {
             // Assume we have been given a URL instead
 }}}

 Example:

 {{{
 $ixr_client = new IXR_Client( 'http://www.example.com/path/' );
 var_dump( $ixr_client );
 }}}

 Output:

 {{{
 object(IXR_Client)#35 (10) {
   ["server"]=>
   string(15) "www.example.com"
   ["port"]=>
   int(80)
   ["path"]=>
   string(6) "/path/"
   ["useragent"]=>
   string(31) "The Incutio XML-RPC PHP Library"
   ["response"]=>
   NULL
   ["message"]=>
   bool(false)
   ["debug"]=>
   bool(false)
   ["timeout"]=>
   int(15)
   ["headers"]=>
   array(0) {
   }
   ["error"]=>
   bool(false)
 }
 }}}

 However, if you send a URL that has a query string, {{{IXR_Client}}}
 ignores it:

 {{{
 $ixr_client = new IXR_Client( 'http://www.example.com/path/?param=arg' );
 var_dump( $ixr_client );
 }}}

 Output (identical to the output above):

 {{{
 object(IXR_Client)#35 (10) {
   ["server"]=>
   string(15) "www.example.com"
   ["port"]=>
   int(80)
   ["path"]=>
   string(6) "/path/"
   ["useragent"]=>
   string(31) "The Incutio XML-RPC PHP Library"
   ["response"]=>
   NULL
   ["message"]=>
   bool(false)
   ["debug"]=>
   bool(false)
   ["timeout"]=>
   int(15)
   ["headers"]=>
   array(0) {
   }
   ["error"]=>
   bool(false)
 }
 }}}

 I don't believe this actually affects WordPress core, but it might cause
 problems for any plugins using {{{IXR_Client}}} or
 {{{WP_HTTP_IXR_Client}}}.

 I've attached a patch that fixes this bug in both {{{IXR_Client}}} and
 {{{WP_HTTP_IXR_Client}}} and results in the same client state if the full
 URL (with query string) is passed in the first argument or if a path (with
 query string) is passed in the second argument.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/26947>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list