Opened 8 months ago
Last modified 7 months ago
#21977 new defect (bug)
Allow 0, NULL and empty string values for 'parent'.
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Future Release |
| Component: | XML-RPC | Version: | |
| Severity: | normal | Keywords: | has-patch dev-feedback 2nd-opinion |
| Cc: |
Description
We must allow 0, NULL and empty string values for 'parent' in wp_newTerm and wp_editTerm
Attachments (3)
Change History (11)
- Milestone changed from Awaiting Review to 3.5
- Severity changed from major to normal
Looks like test_parent_empty() will need to change, and probably be expanded a bit: http://unit-tests.trac.wordpress.org/browser/trunk/tests/xmlrpc/wp/editTerm.php. A similar test does not exist yet for wp/newTerm.
- Type changed from enhancement to defect (bug)
I think it is safe to call this a bug.
comment:4
markoheijnen — 8 months ago
Changed the unit tests and added extra ones to wp.editTerm and wp.newTerm. Also updated the patch of Sam to have it from the root instead of the wp-includes folder.
- Keywords dev-feedback punt added
Does this patch allow for a term with a parent to be set to then have no parent?
I'm not sure about this.
By definition the datatype that should be passed here is a string containing an integer, this is the return value of get_term and the new/edit functions should expect the same.
So ideally the correct value for parent is probably and empty string or '0' and all the tests should be updated to send numbers as strings.
I'm not sure [UT1118] adds completely correct tests.

I don't think this is major — the workaround is to simply not pass 'parent'.
But yes, switching from isset() to ! empty() makes sense.