summaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
Diffstat (limited to 'classes')
-rw-r--r--classes/Safe_DataObject.php24
-rw-r--r--classes/Subscription.php8
2 files changed, 28 insertions, 4 deletions
diff --git a/classes/Safe_DataObject.php b/classes/Safe_DataObject.php
index 08bc6846f..e926cb0d5 100644
--- a/classes/Safe_DataObject.php
+++ b/classes/Safe_DataObject.php
@@ -96,6 +96,30 @@ class Safe_DataObject extends DB_DataObject
$this->_link_loaded = false;
}
+ /**
+ * Magic function called when someone attempts to call a method
+ * that doesn't exist. DB_DataObject uses this to implement
+ * setters and getters for fields, but neglects to throw an error
+ * when you just misspell an actual method name. This leads to
+ * silent failures which can cause all kinds of havoc.
+ *
+ * @param string $method
+ * @param array $params
+ * @return mixed
+ * @throws Exception
+ */
+ function __call($method, $params)
+ {
+ $return = null;
+ // Yes, that's _call with one underscore, which does the
+ // actual implementation.
+ if ($this->_call($method, $params, $return)) {
+ return $return;
+ } else {
+ throw new Exception('Call to undefined method ' .
+ get_class($this) . '::' . $method);
+ }
+ }
/**
* Work around memory-leak bugs...
diff --git a/classes/Subscription.php b/classes/Subscription.php
index 60c12cccc..0679c0925 100644
--- a/classes/Subscription.php
+++ b/classes/Subscription.php
@@ -88,8 +88,8 @@ class Subscription extends Memcached_DataObject
self::blow('user:notices_with_friends:%d', $subscriber->id);
- $subscriber->blowSubscriptionsCount();
- $other->blowSubscribersCount();
+ $subscriber->blowSubscriptionCount();
+ $other->blowSubscriberCount();
$otherUser = User::staticGet('id', $other->id);
@@ -213,8 +213,8 @@ class Subscription extends Memcached_DataObject
self::blow('user:notices_with_friends:%d', $subscriber->id);
- $subscriber->blowSubscriptionsCount();
- $other->blowSubscribersCount();
+ $subscriber->blowSubscriptionCount();
+ $other->blowSubscriberCount();
Event::handle('EndUnsubscribe', array($subscriber, $other));
}