Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
In the Beta version, I attempted to use Show Diff between two nodes but it resulted in a WSOD.
In the 7.x-2.x version, the Show Diff seems to work, but there are errors reported in the log messages:
- Notice: Trying to get property of non-object in diff_diffs_show() (line 172 of /sites/all/modules/diff/diff.pages.inc).
- Warning: date_timezone_set() expects parameter 1 to be DateTime, boolean given in format_date() (line 1938 of /includes/common.inc).
- Warning: date_format() expects parameter 1 to be DateTime, boolean given in format_date() (line 1948 of /includes/common.inc).
- Notice: Trying to get property of non-object in diff_diffs_show() (line 172 of /sites/all/modules/diff/diff.pages.inc).
- Notice: Undefined index: images in diff_diffs_show() (line 173 of /sites/all/modules/diff/diff.pages.inc).
- Notice: Trying to get property of non-object in diff_diffs_show() (line 177 of /sites/all/modules/diff/diff.pages.inc).
- Notice: Trying to get property of non-object in node_diff() (line 16 of /sites/all/modules/diff/includes/node.inc).
- Notice: Trying to get property of non-object in node_diff() (line 18 of /sites/all/modules/diff/includes/node.inc).
- Notice: Undefined index: field_name in node_diff() (line 29 of /sites/all/modules/diff/includes/node.inc).
- EntityMalformedException: Missing bundle property on entity of type node. in entity_extract_ids() (line 7539 of /includes/common.inc).
I'm not sure why $new_node->revision_timestamp;
results in a Notice: Trying to get property of non-object.
$old_node->revision_timestamp
works fine, as does $node->revision_timestamp
. $node->revision_timestamp
matches $new_node->revision_timestamp
.
Comment | File | Size | Author |
---|---|---|---|
#5 | diff-1708696-5-Refactored-_diff_body_rows-function.patch | 5.39 KB | Alan D. |
Comments
Comment #1
mitchell CreditAttribution: mitchell commented7.x-3.x introduced support for diffs between different nodes. Please reopen if problem persists in 7.x-3.x branch.
Comment #2
Alan D. CreditAttribution: Alan D. commentedNo direct comparison was included. Can you let me know how you were doing this please?
It may point to an unknown bug within the code although at this stage I think it is a GIGO bug...
Comment #3
mitchell CreditAttribution: mitchell commentedComment #4
Alex Andrascu CreditAttribution: Alex Andrascu commentedInterested in this one aswell. Can you please provide an example of how to diff between 2 entities.
Thanks.
Comment #5
Alan D. CreditAttribution: Alan D. commentedI am writing a administrative logging module and I'm needing entity diff's for the logs too.
This first patch abstracts out the logic from _diff_body_rows() into diff_entity_body_rows(). This has most of the logic for the UI and internally calls diff_compare_entities() for the actual comparison. This function does not cover the header row.
I'm using a custom CTool plugin that calls this to render the diff as a string for insertion into the log.
Comment #6
Alan D. CreditAttribution: Alan D. commentedA smaller example for user entities (should work without #2110371: Providing User entity support) but requires the above patch.
Comment #7
Alan D. CreditAttribution: Alan D. commentedAdded in cdee341