Closed (duplicate)
Project:
Drupal core
Version:
6.16
Component:
node system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
8 Mar 2010 at 11:52 UTC
Updated:
25 Jun 2010 at 16:02 UTC
The following script prints a wrong result:
$node=new stdClass();
$node->title='My Node';
node_save($node);
var_dump($node->nid);
var_dump($node->vid);
$node=node_load($node->nid);
var_dump($node->nid);
var_dump($node->vid);
$node->revision=true;
node_save($node);
var_dump($node->nid);
var_dump($node->vid);
$nid=$node->nid;
$node=node_load($nid);
var_dump($node->nid);
var_dump($node->vid);
exit();
-----------------------------------
example output:
string(2) "86"
string(3) "163"
string(2) "86"
string(3) "163"
string(2) "86"
string(3) "164"
string(2) "86"
string(3) "163"expected output (in this example):
string(2) "86"
string(3) "163"
string(2) "86"
string(3) "163"
string(2) "86"
string(3) "164"
string(2) "86"
string(3) "164"An xdebug-trace of the final node_load() reveals what the problem is:
node_load() simply takes the cache from the previous node_load(), not considering that this cache has become stale by us calling node_save(). This happens in node.module in lines 707-710.
Database content is not directly affected by this bug: Data sets in the database correctly reflect the new revision (164).
However user scripts may cause inconsistencies in the database by relying on wrong information returned by node_load().
Comments
Comment #1
BauerDigitalKG commentedWe've reviewed the bug again: It is also present in version 6.16.
Comment #2
dtrdewaele commentedIs this bug fixed in Drupal 6.17? I have a simular problem with cck data that is not coming correctly from cache.
Comment #3
damien tournoud commentedDuplicate of #221081: Entity cache out of sync and inconsistent when saving/deleting entities.