Merge pull request #8346 from MrPetovan/bug/notices

Do not cache Contact::getDetailsByURL result if it doesn't come from the DB
This commit is contained in:
Philipp 2020-02-29 17:58:57 +01:00 committed by GitHub
commit b1b6533512
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1037,6 +1037,7 @@ class Contact
}
if (DBA::isResult($r)) {
$authoritativeResult = true;
// If there is more than one entry we filter out the connector networks
if (count($r) > 1) {
foreach ($r as $id => $result) {
@ -1070,6 +1071,7 @@ class Contact
$profile["bd"] = DBA::NULL_DATE;
}
} else {
$authoritativeResult = false;
$profile = $default;
}
@ -1106,7 +1108,11 @@ class Contact
$profile["birthday"] = DBA::NULL_DATE;
}
$cache[$url][$uid] = $profile;
// Only cache the result if it came from the DB since this method is used in widely different contexts
// @see display_fetch_author for an example of $default parameter diverging from the DB result
if ($authoritativeResult) {
$cache[$url][$uid] = $profile;
}
return $profile;
}