Make WordPress Core

Opened 7 years ago

Last modified 5 years ago

#42995 new defect (bug)

WordPress XML-RPC editComment return error 500 changing date_created_gmt

Reported by: fpilee's profile fpilee Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.9.1
Component: XML-RPC Keywords: reporter-feedback
Focuses: Cc:

Description

Grettings,

This:

Do some timestamp voodoo
if (!empty($content_structdate_created_gmt?)) {

We know this is supposed to be GMT, so we're going to slap that Z on there by force
$dateCreated = rtrim($content_structdate_created_gmt?->getIso(), 'Z') . 'Z';
$comment_date = get_date_from_gmt(iso8601_to_datetime($dateCreated));
$comment_date_gmt = iso8601_to_datetime($dateCreated, 'GMT');

}

[Thu Dec 28 15:52:34.123148 2017] [php7:notice] [pid 5507] [client 127.0.0.1:39464] PHP Fatal error: Uncaught Error: Call to a member function getIso() on string in wp-includes/class-wp-xmlrpc-server.php:3533

Change History (3)

#1 @fpilee
7 years ago

I believe you have to create first a https://developer.wordpress.org/reference/classes/ixr_date/
object with date_created_gmt string before to call getIso.

#2 @fpilee
7 years ago

I confirm that the issue is that.
You could add this to the line 3532 and it will work fine.

            $__date = new \DateTime($content_struct['date_created_gmt'] );
            $content_struct['date_created_gmt'] = new IXR_Date($__date->getTimestamp() );
Last edited 7 years ago by fpilee (previous) (diff)

#3 @desrosj
5 years ago

  • Keywords reporter-feedback added
  • Summary changed from Wordpress XML-RPC editComment return error 500 changing date_created_gmt to WordPress XML-RPC editComment return error 500 changing date_created_gmt

Hi @fpilee,

Thanks for this report, and welcome to Trac!

Can you provide some code that someone can use to reproduce the issue?

Note: See TracTickets for help on using tickets.