mirror of
https://github.com/friendica/friendica
synced 2024-11-19 04:23:41 +00:00
Merge pull request #5951 from annando/endless-contact
Avoid endless loop when trying to fetch contact id
This commit is contained in:
commit
da2a17495d
1 changed files with 4 additions and 3 deletions
|
@ -1021,10 +1021,11 @@ class Contact extends BaseObject
|
|||
* @param integer $uid The user id for the contact (0 = public contact)
|
||||
* @param boolean $no_update Don't update the contact
|
||||
* @param array $default Default value for creating the contact when every else fails
|
||||
* @param boolean $in_loop Internally used variable to prevent an endless loop
|
||||
*
|
||||
* @return integer Contact ID
|
||||
*/
|
||||
public static function getIdForURL($url, $uid = 0, $no_update = false, $default = [])
|
||||
public static function getIdForURL($url, $uid = 0, $no_update = false, $default = [], $in_loop = false)
|
||||
{
|
||||
logger("Get contact data for url " . $url . " and user " . $uid . " - " . System::callstack(), LOGGER_DEBUG);
|
||||
|
||||
|
@ -1138,8 +1139,8 @@ class Contact extends BaseObject
|
|||
}
|
||||
}
|
||||
|
||||
if (!$contact_id && ($data["alias"] != '') && ($data["alias"] != $url)) {
|
||||
$contact_id = self::getIdForURL($data["alias"], $uid, true);
|
||||
if (!$contact_id && ($data["alias"] != '') && ($data["alias"] != $url) && !$in_loop) {
|
||||
$contact_id = self::getIdForURL($data["alias"], $uid, true, $default, true);
|
||||
}
|
||||
|
||||
$url = $data["url"];
|
||||
|
|
Loading…
Reference in a new issue