Ticket #4469 (closed defect: fixed)

Opened 1 year ago

Last modified 6 months ago

Accept 'open' and 'closed' as valid values for mt_allow_comments and mt_allow_pings in XML-RPC

Reported by: josephscott Assigned to: anonymous
Priority: normal Milestone: 2.2.1
Component: XML-RPC Version: 2.2
Severity: normal Keywords: has-patch
Cc:

Description

The correct value for mt_allow_comments and mt_allow_pings is 1 or 0 (zero), however, WordPress has historically supported the strings closed and open as valid values. With the included patch we now support all four potential values.

Attachments

xmlrpc.php.diff (3.1 kB) - added by josephscott on 06/15/07 00:53:06.
xmlrpc.php.2.diff (3.8 kB) - added by josephscott on 06/19/07 18:30:37.
xmlrpc.php.3.diff (4.2 kB) - added by josephscott on 06/19/07 18:56:53.
xmlrpc.php-2.2.diff (4.3 kB) - added by josephscott on 06/19/07 19:30:32.

Change History

06/15/07 00:53:06 changed by josephscott

  • attachment xmlrpc.php.diff added.

06/15/07 16:45:23 changed by rob1n

  • milestone set to 2.3 (trunk).

06/15/07 21:17:06 changed by foolswisdom

  • keywords set to has-patch.
  • version set to 2.3.

06/19/07 16:21:36 changed by redsweater

Thanks, Joseph. Nice work on these changes. I was reviewing them as I noticed some behavior in 2.2 that is changed significantly from previous releases. I reported these separately in http://trac.wordpress.org/ticket/4489 because I hope they can be fixed earlier than 2.3.

As for these changes, I have some additional comments which might be motivated by my poor understanding of PHP, but:

It appears to me that in this patch, if the client sends an unrecognized string value in the status field, it will get blindly copied into the comment_status or ping_status variable. For instance, what happens if my client sends "bogus" as the comment status? The desired behavior is probably again that the default status be used.

I suggest being as explicit in the non-numeric case as you are in the numeric case. If it's non-numeric it has to be either "open" or "closed", and if numeric, it has to be either 0 or 1. In all other cases the values should be the default status.

06/19/07 18:30:37 changed by josephscott

  • attachment xmlrpc.php.2.diff added.

06/19/07 18:33:04 changed by josephscott

Based on redsweater's comments I've updated this patch to look for values of "open" and "closed". I've also adjusted the mw_newPost checks to use the default comment and ping options if none were provided (see http://trac.wordpress.org/ticket/4489).

06/19/07 18:56:53 changed by josephscott

  • attachment xmlrpc.php.3.diff added.

06/19/07 18:58:38 changed by josephscott

Updated patch to include the tighter open/close string checks for mw_editPost as well. The only difference between the checks in mw_newPost and mw_editPost is that mw_newPost will use the default comment/ping setting even if the option wasn't provided.

06/19/07 19:01:46 changed by ryan

  • milestone changed from 2.3 (trunk) to 2.2.1.

06/19/07 19:12:25 changed by ryan

(In [5729]) Accept 'open' and 'closed' as valid values for mt_allow_comments and mt_allow_pings in XML-RPC. Props Joseph Scott. see #4469

06/19/07 19:30:32 changed by josephscott

  • attachment xmlrpc.php-2.2.diff added.

06/19/07 19:30:50 changed by josephscott

New patch for the 2.2 branch.

06/19/07 19:37:05 changed by ryan

(In [5730]) Accept 'open' and 'closed' as valid values for mt_allow_comments and mt_allow_pings in XML-RPC. Props Joseph Scott. For 2.2. see #4469

06/19/07 20:05:47 changed by markjaquith

Are we going to sneak this into 2.2.1 (that is, when we build 2.2.1, build it from /branches/2.2/ revision 5730)? I'm +1 for that.

06/19/07 20:57:20 changed by ryan

  • status changed from new to closed.
  • version changed from 2.3 to 2.2.
  • resolution set to fixed.

Yep, it's going in 2.2.