wrong revision of node displayed
| Project: | PHPTemplate |
| Version: | HEAD |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
This bug is actually against Drupal 5.3, but that option was not available when submitting the issue. I have not tested with Drupal 6.
The problem occurs when a module like revision_moderation is used. Or any module that allows users to view multiple revisions of a node. These modules use paths like node/NNN/revision/MMM to show a particular revision of the node.
The problem in phptemplate_page is this:
if ((arg(0) == 'node') && is_numeric(arg(1))) {
$variables['node'] = node_load(arg(1));
}This code simply loads the current revision of the node. Unaware that revision_moderation (or other modules) are displaying an older, or newer revision. Any theme that makes use of the 'node' variable gets incorrect information. Also there is the unnecessary overhead of loading the current revision of the node, when another revision has already been loaded.
The attached patch solves the issue for me. It does so by caching (in memory) the node passed to phptemplate_node(). This way, no matter what URL scheme a module uses to display revisions, the proper one will be include in the phptemplate variables.
| Attachment | Size |
|---|---|
| phptemplate_revision.diff | 1.23 KB |
