Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion application/forms/ConfigForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public function init()
$this->setSubmitLabel(t('Save Changes'));
}

public function createElements(array $formData)
public function createElements(array $formData): void
{
$this->addElement('number', 'http_timeout', [
'label' => t('Timeout for HTTP calls in seconds'),
Expand Down
4 changes: 2 additions & 2 deletions application/forms/FeedForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ protected function assemble(): void
}
}

public function isValid()
public function isValid(): bool
{
if ($this->getPressedSubmitElement()->getName() === 'delete') {
$csrfElement = $this->getElement('CSRFToken');
Expand Down Expand Up @@ -175,7 +175,7 @@ public function hasDeleteButton(): bool
return $this->deleteButtonName !== null;
}

public function shouldBeDeleted()
public function shouldBeDeleted(): bool
{
if (!$this->hasDeleteButton()) {
return false;
Expand Down
2 changes: 1 addition & 1 deletion library/Feeds/Parser/JsonfeedParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class JsonfeedParser
*/
public static function parse(string $raw): Feed
{
$json = json_decode($raw, true);
$json = json_decode($raw, true, 512, JSON_THROW_ON_ERROR);
if ($json === null) {
throw new Exception('Invalid JSONfeed');
}
Expand Down
7 changes: 0 additions & 7 deletions library/Feeds/Parser/RSSParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,6 @@ protected static function parseDateTime(string $dateStr): ?DateTime
);
}

if ($datetime === false) {
$datetime = DateTime::createFromFormat(
DateTimeInterface::RFC7231,
$dateStr,
);
}

if ($datetime === false) {
try {
$datetime = new DateTime($dateStr);
Expand Down
9 changes: 8 additions & 1 deletion library/Feeds/Storage/FilesystemStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Icinga\Module\Feeds\Storage;

use Icinga\Application\Icinga;
use Icinga\Application\Logger;
use Icinga\Exception\NotReadableError;
use Icinga\Exception\NotWritableError;
use Icinga\Exception\SystemPermissionException;
Expand Down Expand Up @@ -67,6 +68,7 @@ protected function loadFeedFile(string $filename): FeedDefinition
throw new NotReadableError('Could not read file %s', $filePath);
}

// This will throw an expection, which we will catch just like the others
$json = Json::decode($data, true);
$feed = FeedDefinition::fromArray($json);

Expand Down Expand Up @@ -171,7 +173,12 @@ protected function load(): void
continue;
}

$feed = $this->loadFeedFile($name);
try {
$feed = $this->loadFeedFile($name);
} catch (Exception $ex) {
Logger::error('Failed to load feed file "%s": %s', $name, $e);
continue;
}

if ($feed->name === '') {
continue;
Expand Down