ansonphong / postworld

Wordpress Theme Development Framework
GNU General Public License v2.0
7 stars 0 forks source link

Set Post Relationships // Corrupted Data in Tables #69

Closed ansonphong closed 10 years ago

ansonphong commented 10 years ago

Hi Haidy, I've been working with set_post_relationship() and all of the sudden it gives me an error about "get_post_relationship" expecting an array. So I looked at the database field, and I can see it's randomly been written as a serialized object, as you can see.

It's working most of the time, and then suddenly it did this.

image

{"viewed":[],"favorites":{"0":178518,"1":"178375","2":"177568","3":"177526","5":"178303"},"view_later":[]}

I haven't had that issue since (it only happened once) though I had to totally reset it.

I don't expect that you'll try to troubleshoot this, since I don't know how to re-create it, although do you have any ideas why this could be happening?

ansonphong commented 10 years ago

OK on testing, this is happening again. We should fix this somehow. Here is the error which makes it apparent, in addition to the function not returning normally.

Warning: in_array() expects parameter 2 to be array, object given in /Users/phong/Projects Clients/Reality Sandwich/_WEB/RSV2/WORDPRESS/wp-content/plugins/postworld/php/postworld_users.php on line 745
ansonphong commented 10 years ago

Here is another example of corrupted object.

{"viewed":[],"favorites":{"1":176466,"2":176363,"3":176241,"4":175925},"view_later":[176967,176721,176595]}

You can see it's localized to a single sub-object and isn't effecting the whole object, just the one which is being set.

hmikhail commented 10 years ago

Issue Solved.