When trying to invoke node.save through json_server, the taxonomy field gets unserialized as object, which causes an error in form.inc. A simple solution to this:

if (isset($edit['taxonomy'])) {
$edit['taxonomy'] = (array) $edit['taxonomy'];
}

(I don't have the dev version handy, but it goes 'round line 170 of the 2.4 version of node_service.inc).

Comments

IncrediblyKenzi’s picture

Version: 6.x-2.4 » 6.x-2.x-dev
Status: Active » Needs review
StatusFileSize
new819 bytes

Attaching patch for this issue.

Status: Needs review » Needs work

The last submitted patch, node_service_taxonomy_cast.patch, failed testing.

d7’s picture

In services 3.x the same issue exists... the patch suggested above works to fix the _node_resource_update and _node_resource_create functions. Something like, where it says $node = (object)$node; -- one adds the following line directly below.

$node['taxonomy'] = (array) $node['taxonomy'];

marcingy’s picture

Version: 6.x-2.x-dev » 7.x-3.x-dev

This needs to be fixed on 3.x and then backported.

marcingy’s picture

Version: 7.x-3.x-dev » 6.x-3.x-dev

Actually this should be 3.x as taxonomy is fields in d7, my bad.

ygerasimov’s picture

Status: Needs work » Needs review
StatusFileSize
new2.74 KB

@d7, @acstewart please check whether problem still exists on 6.x-3.x?

Here is attached patch that adds test to the node resource tests. It creates a node with terms attached. It passes properly and node get created with terms properly.

kylebrowning’s picture

Status: Needs review » Needs work

Patch does not apply to current 6.x-3.x branch

kylebrowning’s picture

Status: Needs work » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.