]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Fix for failure/exception on subscription/subscriber lists when deleted profiles...
authorBrion Vibber <brion@pobox.com>
Fri, 11 Feb 2011 21:21:53 +0000 (13:21 -0800)
committerBrion Vibber <brion@pobox.com>
Fri, 11 Feb 2011 21:21:53 +0000 (13:21 -0800)
Workaround for deleted profiles still appearing in cached subscriptions/subscribers lists: if we couldn't fetch them, don't include them in the ArrayWrapper.
ArrayWrapper doesn't deal well with null entries, which aren't meant to happen in how it works. This code has recently changed from dying directly with a PHP fatal error in that case to throwing an exception, which allows tracking down the caller.

It looks like there might be some cases where profiles and their matching subscriptions get deleted, but the subscription entries don't get properly cleared from cache... that still bears further investigation. The regular code path looks ok; calls Subscription::cancel() from code called in Profile::delete(); but if they're batch-deleted instead of one row at a time, that could fail to trigger.

classes/Profile.php

index 03f930096257854eb6c7b636c22133cc150f083b..bdac3ba453aa6e09dfd1e247aff7b98b30a1ac71 100644 (file)
@@ -354,7 +354,10 @@ class Profile extends Memcached_DataObject
         $profiles = array();
 
         while ($subs->fetch()) {
-            $profiles[] = Profile::staticGet($subs->subscribed);
+            $profile = Profile::staticGet($subs->subscribed);
+            if ($profile) {
+                $profiles[] = $profile;
+            }
         }
 
         return new ArrayWrapper($profiles);
@@ -369,7 +372,10 @@ class Profile extends Memcached_DataObject
         $profiles = array();
 
         while ($subs->fetch()) {
-            $profiles[] = Profile::staticGet($subs->subscriber);
+            $profile = Profile::staticGet($subs->subscriber);
+            if ($profile) {
+                $profiles[] = $profile;
+            }
         }
 
         return new ArrayWrapper($profiles);