Been trying to track this down for a while. It does seem like a corruption deal, but have ironed out the issue all the way down to 1 location and cannot figure out a solution, nor where it's maybe going wrong.

When ADDING content with a Fivestar CCK field using "return $node-nid;" for the Voting target PHP Code, the cache is broken and the other CCK fields appear to be broken. Clearing cache (or that entry from cache_content) fixes the problem. Everything is fine except for the cache entry that is entered upon adding the node.

Additionally, when UPDATING the content, the issue does not exist and things work as expected.

It seems like this would be a result of $node causing some error because it is not yet defined, however, the rating_target field in the database is correctly assigned using the code above. Further, entering "return 10;" does not cause the cache problem.

Any ideas? I'm open to discus this or try anything out. I'm very familiar with the way things are working as we've been tracking down the problem for some time.

Comments

ezra-g’s picture

Priority: Critical » Normal
Status: Active » Postponed (maintainer needs more info)

Can you be more specific than "cache is broken and the other CCK fields appear to be broken"? What does "broken" mean?

ezra-g’s picture

Status: Postponed (maintainer needs more info) » Fixed

Marking as fixed in absence of a response.

Status: Fixed » Closed (fixed)

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

lionstone’s picture

I assume you realize that "return $node-nid;" is invalid PHP syntax? try "return $node->nid;"?

agileware’s picture

Status: Closed (fixed) » Needs review
StatusFileSize
new940 bytes

I can confirm this problem.

I have a fivestar cck field that has:

<?php
if (isset($node->nid) && $node->nid) {
  return $node->nid;
}
?>

for the "Voting target PHP code".

When I create a new node and save my node saves properly to the database but when viewing or editing the node, all the cck fields appear to have not saved until you clear the cache (surprisingly enough even when all caching is disabled).

It took me a while to track the problem to fivestar but the problem seems to stem from calling node_load() on the current node while in hook_nodeapi() insert.

This patch fixes it for me.
Note that you might want to change the code comment in the patch if my explanation isn't up to scratch.
It is against 6.x-1.x-dev but applies with offset to 6.x-1.19.

- It is also quite confusing that an issue be marked as fixed when it wasn't fixed.
closed (cannot reproduce) might have been better.

yoda-fr’s picture

Hello there,
same problem here. When I create a node with field widget type "stars" and php code :

if (isset($node->nid) && $node->nid) {
  return $node->nid;
}

as "Voting target PHP code", all the cck fields are not saved. If I modify this new node or if the node publication is "published" during the first save all is ok.

I don't know how to solve this, can somebody can explain me why the cck fields ar not save during the creation of the node if it is not published?

Thanks a lot...
PS: the patch of #5 does not work for me. It saves the cck fields but the vote and the average are not good.

yoda-fr’s picture

In fact all is ok when the cache is cleared and once the node is published...
Thanks for this module, awesome ;)

whiteph’s picture

Issue summary: View changes
Status: Needs review » Closed (won't fix)

We can no longer support the Drupal 6 version of Fivestar. It is in security maintenance mode only. When the Drupal 8 version of Fivestar is released, the Drupal 6 version will be officially deprecated.

whiteph’s picture