From: Mikael Nordfeldth Date: Thu, 3 Jul 2014 09:55:24 +0000 (+0200) Subject: Occasionally we'd get a false from Profile::getKV X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=1f97376813795435c20223ecbd0e8a83871ae3a1;p=quix0rs-gnu-social.git Occasionally we'd get a false from Profile::getKV Due to cache miss? Probably, but now we simply say that it's null in that case so we get a proper exception from Notice::_setProfiles --- diff --git a/classes/Notice.php b/classes/Notice.php index ebf874bffb..74f2f6aa91 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -150,7 +150,10 @@ class Notice extends Managed_DataObject public function getProfile() { if (!isset($this->_profile[$this->profile_id])) { - $this->_setProfile(Profile::getKV('id', $this->profile_id)); + // We could've sent getKV directly to _setProfile, but occasionally we get + // a "false" (instead of null), likely because it indicates a cache miss. + $profile = Profile::getKV('id', $this->profile_id); + $this->_setProfile($profile instanceof Profile ? $profile : null); } return $this->_profile[$this->profile_id]; }