Code is Poetry.
WordPress' code just... wasn't. This is now dealt with. Props jrf, pento, netweb, GaryJ, jdgrimes, westonruter, Greg Sherwood from PHPCS, and everyone who's ever contributed to WPCS and PHPCS. Fixes #41057. Built from https://develop.svn.wordpress.org/trunk@42343 git-svn-id: http://core.svn.wordpress.org/trunk@42172 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -162,13 +162,15 @@ class WP_HTTP_Requests_Response extends WP_HTTP_Response {
|
||||
public function get_cookies() {
|
||||
$cookies = array();
|
||||
foreach ( $this->response->cookies as $cookie ) {
|
||||
$cookies[] = new WP_Http_Cookie( array(
|
||||
'name' => $cookie->name,
|
||||
'value' => urldecode( $cookie->value ),
|
||||
'expires' => isset( $cookie->attributes['expires'] ) ? $cookie->attributes['expires'] : null,
|
||||
'path' => isset( $cookie->attributes['path'] ) ? $cookie->attributes['path'] : null,
|
||||
'domain' => isset( $cookie->attributes['domain'] ) ? $cookie->attributes['domain'] : null,
|
||||
));
|
||||
$cookies[] = new WP_Http_Cookie(
|
||||
array(
|
||||
'name' => $cookie->name,
|
||||
'value' => urldecode( $cookie->value ),
|
||||
'expires' => isset( $cookie->attributes['expires'] ) ? $cookie->attributes['expires'] : null,
|
||||
'path' => isset( $cookie->attributes['path'] ) ? $cookie->attributes['path'] : null,
|
||||
'domain' => isset( $cookie->attributes['domain'] ) ? $cookie->attributes['domain'] : null,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return $cookies;
|
||||
@@ -183,13 +185,13 @@ class WP_HTTP_Requests_Response extends WP_HTTP_Response {
|
||||
*/
|
||||
public function to_array() {
|
||||
return array(
|
||||
'headers' => $this->get_headers(),
|
||||
'body' => $this->get_data(),
|
||||
'headers' => $this->get_headers(),
|
||||
'body' => $this->get_data(),
|
||||
'response' => array(
|
||||
'code' => $this->get_status(),
|
||||
'message' => get_status_header_desc( $this->get_status() ),
|
||||
),
|
||||
'cookies' => $this->get_cookies(),
|
||||
'cookies' => $this->get_cookies(),
|
||||
'filename' => $this->filename,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user