Merge pull request #8452 from annando/issue-8254

Issue 8254: Length restriction for "title" and "uri"
This commit is contained in:
Tobias Diekershoff 2020-03-25 12:07:26 +01:00 committed by GitHub
commit e4dbc09601
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1429,7 +1429,7 @@ class Item
} }
$item['guid'] = self::guid($item, $notify); $item['guid'] = self::guid($item, $notify);
$item['uri'] = Strings::escapeTags(trim(($item['uri'] ?? '') ?: self::newURI($item['uid'], $item['guid']))); $item['uri'] = substr(Strings::escapeTags(trim(($item['uri'] ?? '') ?: self::newURI($item['uid'], $item['guid']))), 0, 255);
// Store URI data // Store URI data
$item['uri-id'] = ItemURI::insert(['uri' => $item['uri'], 'guid' => $item['guid']]); $item['uri-id'] = ItemURI::insert(['uri' => $item['uri'], 'guid' => $item['guid']]);
@ -1546,7 +1546,7 @@ class Item
$item['edited'] = (isset($item['edited']) ? DateTimeFormat::utc($item['edited']) : $item['created']); $item['edited'] = (isset($item['edited']) ? DateTimeFormat::utc($item['edited']) : $item['created']);
$item['changed'] = (isset($item['changed']) ? DateTimeFormat::utc($item['changed']) : $item['created']); $item['changed'] = (isset($item['changed']) ? DateTimeFormat::utc($item['changed']) : $item['created']);
$item['commented'] = (isset($item['commented']) ? DateTimeFormat::utc($item['commented']) : $item['created']); $item['commented'] = (isset($item['commented']) ? DateTimeFormat::utc($item['commented']) : $item['created']);
$item['title'] = trim($item['title'] ?? ''); $item['title'] = substr(trim($item['title'] ?? ''), 0, 255);
$item['location'] = trim($item['location'] ?? ''); $item['location'] = trim($item['location'] ?? '');
$item['coord'] = trim($item['coord'] ?? ''); $item['coord'] = trim($item['coord'] ?? '');
$item['visible'] = (isset($item['visible']) ? intval($item['visible']) : 1); $item['visible'] = (isset($item['visible']) ? intval($item['visible']) : 1);