Opened 5 years ago
Closed 4 years ago
#53961 closed defect (bug) (reported-upstream)
InvalidArgumentException with wp_remote_post function
| Reported by: | Hazem Elijla | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | External Libraries | Version: | 5.8 |
| Severity: | normal | Keywords: | reporter-feedback |
| Cc: | Focuses: |
Description
The folllowing code generates a PHP exception:
Overloaded object of type ... is not compatible with RecursiveArrayIterator.
I can't send array contains array or any other objects like Date
wp_remote_post( 'https://api.example.com/', [ 'body' => [ 'name' => 'Hazem', 'email' => 'hazem@example.com', 'date' => new DateTime( 'NOW' ), 'additional' => [ 'example' => 1, ] ] ] );
After checking wp core code found that this line causing this issue.
seems like "RecursiveArrayIterator" doesn't support objects or arrays.
code located at:
https://github.com/WordPress/WordPress/blob/master/wp-includes/Requests/Transport/cURL.php
Change History (2)
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Thanks for opening this ticket.
The Requests library is an external dependency of WordPress. Please report this issue upstream.