Opened 12 years ago
Closed 12 years ago
#22479 closed defect (bug) (fixed)
Undefined Variable in `mt_setPostCategories()`
Reported by: | ericmann | Owned by: | ryan |
---|---|---|---|
Milestone: | 3.5 | Priority: | normal |
Severity: | minor | Version: | 3.4.2 |
Component: | XML-RPC | Keywords: | has-patch commit |
Focuses: | Cc: |
Description
This will likely only ever come up if WP_DEBUG
is set to true, but we're attempting to add elements to an array inside a foreach
without first creating the array. We then pass a potentially non-existent object along to wp_set_post_categories()
.
This creates a PHP notice that, if WP_DEBUG
is turned on with the server, breaks the document returned to XML-RPC clients attempting to use mt.setPostCategories
to update categories.
The fix is simple. Just create an empty array before trying to add elements to it or passing it out of the function.
Attachments (1)
Change History (5)
#2
follow-up:
↓ 3
@
12 years ago
I had once added on a XML-RPC ticket a fix a lot of notices for non wp.* methods ( #20394 ). Didn't fix this one.
Curious what the policy is for it since then it didn't made it.
#3
in reply to:
↑ 2
@
12 years ago
Replying to markoheijnen:
I had once added on a XML-RPC ticket a fix a lot of notices for non wp.* methods ( #20394 ). Didn't fix this one.
Curious what the policy is for it since then it didn't made it.
I'm not sure. All I can say for certain is that this bug does in fact break the current version of Windows Live Writer (I was using it to test something else entirely when I can across the issue).
Explicitly define the $catids array before trying to manipulate it.