For view fields marked a "serialize" (like "display_options"), there is an inconsistency between the way the data is saved in the database and the way the data is reloaded.
In view::save_row (view.inc, line 1632), field value is saved as "serialize($this->$field)"
But in view::load_row (view.inc, line 1675), field value is reloaded as "unserialize(db_decode_blob($data->$field))"
Luckily, for MySQL, db_decode_blob just returns the passed argument so it does not hurt.
But for other types of databases, it might cause I major problem since Views is unable to read back what it saved in the database.
I hit the problem with SQLite, I did not test it but think it will also be a problem with PostgreSQL.
The fix is fairly simple: replace line 1632 in views.inc with :
$values[] = db_encode_blob(serialize($this->$field));
Thanks for your attention.
Comment | File | Size | Author |
---|---|---|---|
#7 | 807540-revert-6.x-3.x.patch | 997 bytes | dawehner |
#7 | 807540-revert-6.x-2.x.patch | 1.17 KB | dawehner |
#2 | Patch for 3.0-alpha3 | 353 bytes | gfrenoy |
Comments
Comment #1
dawehnerCould you make a patch out of it?
Comment #2
gfrenoy CreditAttribution: gfrenoy commentedPatch for 3.0-alpha3 is attached.
Comment #3
dawehnerupdate status.
Thanks!
Comment #4
dawehnerThis makes sense for me.
Comment #5
merlinofchaos CreditAttribution: merlinofchaos commentedDoes not apply to 7.x so needs porting.
Committed to 6.x.
Comment #6
dawehnerThis patch has to be reverted. This causes the problems in #940104: views-6.x-3.x-dev of Oct 12 empties the contents of fields on save
Comment #7
dawehnerRevert for both versions.
Thanks for git bisect
Comment #8
dagmarComment #9
dagmarYes this patch is causing the problem. I just tested it.
Comment #10
dawehnerReverted the patch
Comment #11
iamjon CreditAttribution: iamjon commentedgfrenoy,
can you try to patch again based on the comments on #940104: views-6.x-3.x-dev of Oct 12 empties the contents of fields on save?
marking this as postponed from lack of activity.
Comment #12
merlinofchaos CreditAttribution: merlinofchaos commented