[wp-trac] [WordPress Trac] #37618: String `$args['body']` passed to`WP_Http::get()` is lost, generates warning

WordPress Trac noreply at wordpress.org
Wed Aug 10 04:14:52 UTC 2016


#37618: String `$args['body']` passed to`WP_Http::get()` is lost, generates warning
--------------------------+--------------------
 Reporter:  dlh           |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  4.6
Component:  HTTP API      |     Version:  trunk
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+--------------------

Comment (by voldemortensen):

 AFAICT, the culprit is here:
 {{{#!php
 // Setup arguments
 $headers = $r['headers'];
 $data = $r['body'];
 $type = $r['method'];
 }}}

 It's just passed as the string all the way down.

 using:
 {{{#!php
 wp_remote_get( 'http://example.com', array( 'body' => array( 'foo' ) ) );
 }}}

 resolves the warnings, however there are probably several plugins in the
 wild that use this.

 I'm not extremely familiar with the Requests library, so I'm unsure what
 the path forward should be. Maybe a _doing_it_wrong, maybe just detecting
 a string and shoving it into an array, maybe both. ¯\_(ツ)_/¯

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


More information about the wp-trac mailing list