Ward againt contact_id = 0 in UpdateContact worker

- Add parameter validation in Worker\UpdateContact::add
- Address https://github.com/friendica/friendica/issues/12487#issuecomment-1366833644
This commit is contained in:
Hypolite Petovan 2022-12-28 19:09:34 -05:00
parent 5af956b92f
commit e563de4de7
5 changed files with 71 additions and 17 deletions

View file

@ -26,8 +26,10 @@ use Friendica\Content\ContactSelector;
use Friendica\Content\Nav;
use Friendica\Content\Pager;
use Friendica\Content\Widget;
use Friendica\Core\Logger;
use Friendica\Core\Protocol;
use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\Core\Theme;
use Friendica\Core\Worker;
use Friendica\Database\DBA;
@ -37,6 +39,7 @@ use Friendica\Model\User;
use Friendica\Module\Security\Login;
use Friendica\Network\HTTPException\InternalServerErrorException;
use Friendica\Network\HTTPException\NotFoundException;
use Friendica\Worker\UpdateContact;
/**
* Manages and show Contacts and their content
@ -129,7 +132,11 @@ class Contact extends BaseModule
// pull feed and consume it, which should subscribe to the hub.
Worker::add(Worker::PRIORITY_HIGH, 'OnePoll', $contact_id, 'force');
} else {
Worker::add(Worker::PRIORITY_HIGH, 'UpdateContact', $contact_id);
try {
UpdateContact::add(Worker::PRIORITY_HIGH, $contact_id);
} catch (\InvalidArgumentException $e) {
Logger::notice($e->getMessage(), ['contact' => $contact, 'callstack' => System::callstack()]);
}
}
}