EZP-25240 for full insight of the bug.
We had content item A that relied on an object relation to content item B. The target of the relation (content item B) got put in the trash.
When content item B got put in the trash, the display of the content item A crashed. This was expected because we needed to handle an exception in that case. However, we then followed these steps:
- Edit content item A to remove the relation. Display of content item A restored
- Restore content item B to original location. Display of content item A is still fine as expected.
- Edit content item A and add content item B to the object relation field. Display of content item A crashes again. This is not expected.
- Clear memcache: telnet localhost 11211; flush_all; quit. Display of content item A is restored.
Here's a quick way to test: presuming your object relation field is called "single_relation", try to access the main location ID of content item B like this:
On a standalone install, the same test must be executed twice.
The first time on your step 8, it was still showing null (even though the object relation was still there and there was a real location ID). On steps 9/10 it actually did update properly, although it's a problem that on step 8 it was still showing NULL.
The second time on both step 8 and steps 9/10 it was showing the old, no longer valid location ID.
All tests are against the observed result of this var_dump in the "Controller test suggestion":
- Created new class with an "object relation" (singular) attribute;
- Created 2 Contents for the new class, "5239 Item A" and "5239 Item B";
- Edited "5239 Item A" and related it with "5239 Item B" using the existing "object relation" field;
- Visualized "5239 Item A" on an existing new stack frontend siteaccess, made sure related "5239 Item B" was displayed properly. var_dump shows, say, 147
- Deleted "5239 Item B" into trash. While this is operation is still happening, load item A repeatedly in your browser.
- Visualized "5239 Item A" on frontend. var_dump shows the old location ID. This is not expected. You would expect to see NULL.
- Restore "5239 Item B" from trash to its original location. Item A still shows the old location ID.
- Edited "5239 Item A" and removed the "5239 Item B" relation; Visualized Item A on the front-end. At this point Item A actually crashes since you've tried to load a non-existent object and node. This is expected.
- Edited "5239 Item A" again and re-established relation to "5239 Item B".