Make WordPress Core

Opened 5 months ago

Last modified 5 months ago

#53961 new defect (bug)

InvalidArgumentException with wp_remote_post function

Reported by: Hazem Elijla Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 5.8
Component: External Libraries Keywords: close
Focuses: Cc:


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( '', [
	'body'   => [
		'name'       => 'Hazem',
		'email'      => '',
		'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:

Change History (1)

#1 @jrf
5 months ago

  • Component changed from HTTP API to External Libraries
  • Keywords close added

Thanks for opening this ticket.

The Requests library is an external dependency of WordPress. Please report this issue upstream.

Note: See TracTickets for help on using tickets.