A loose type comparison in EntityDrupalWarpper::set() incorrectly equates 0 = null. as a result is fails to update the parent EntityDrupalWrapper object and the authorship stays as the old value.
The solution is a contender for trivial patch of the month club but took the better part of the afternoon to track down ;). Im not much of a "mark it as critical" guy but this one seems appropriate.
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | entity_tpotm_club-7.patch | 555 bytes | Paul B |
| #6 | entity_tpotm_club-6.patch | 551 bytes | Paul B |
| entity_tpotm_club.patch | 491 bytes | michaelfavia |
Comments
Comment #1
DaneMacaulay commentedTest case:
Comment #2
DaneMacaulay commentedComment #3
fagoI don't think it's critical as it doesn't render the module unusable, but anyway - good catch, committed thanks.
Comment #5
Paul B commentedThis patch is causing some problems for me. I'm using the Relation
module with the patch in #1958298: Relation property on entity_metadata_wrapper().
I have a Treatment entity that is related to a Profile through a treatment_has_carer Relation.
The Relation has a field that is set to 0 when the status of the Treatment changes:
With the patch, this no longer works. For example, I have treatment 56 that has relation 95:
It seems that in EntityDrupalWrapper::set(), the $previous_id is 95,
but $this->id is "95". So it now calls updateParent(), which fails. If
I add a setter callback to the property info in #1958298: Relation property on entity_metadata_wrapper() it
succeeds, but this property should be read-only as it's not a 'real'
property.
Comment #6
Paul B commentedThe patch should fix it.
Comment #7
Paul B commentedreroll.