mirror of
https://github.com/wallabag/wallabag.git
synced 2026-03-09 23:57:40 +01:00
Merge pull request #8701 from wallabag/fix/php82-83-deprecations
Fix PHP 8.2/8.3 deprecations in URL import and config validation
This commit is contained in:
@ -100,7 +100,7 @@ class UrlCommand extends Command
|
||||
|
||||
$this->entityManager->persist($entry);
|
||||
|
||||
$tags = explode(',', $input->getArgument('tags'));
|
||||
$tags = explode(',', (string) $input->getArgument('tags'));
|
||||
if (\count($tags) > 1) {
|
||||
$this->tagsAssigner->assignTagsToEntry(
|
||||
$entry,
|
||||
|
||||
@ -33,7 +33,8 @@ class Config
|
||||
*/
|
||||
#[ORM\Column(name: 'items_per_page', type: 'integer', nullable: false)]
|
||||
#[Assert\NotBlank]
|
||||
#[Assert\Range(min: 1, max: 100000, maxMessage: 'validator.item_per_page_too_high')]
|
||||
#[Assert\GreaterThanOrEqual(value: 1, message: 'validator.item_per_page_too_low')]
|
||||
#[Assert\LessThanOrEqual(value: 100000, message: 'validator.item_per_page_too_high')]
|
||||
#[Groups(['config_api'])]
|
||||
private $itemsPerPage;
|
||||
|
||||
@ -56,7 +57,8 @@ class Config
|
||||
* @var int|null
|
||||
*/
|
||||
#[ORM\Column(name: 'feed_limit', type: 'integer', nullable: true)]
|
||||
#[Assert\Range(min: 1, max: 100000, maxMessage: 'validator.feed_limit_too_high')]
|
||||
#[Assert\GreaterThanOrEqual(value: 1, message: 'validator.feed_limit_too_low')]
|
||||
#[Assert\LessThanOrEqual(value: 100000, message: 'validator.feed_limit_too_high')]
|
||||
#[Groups(['config_api'])]
|
||||
private $feedLimit;
|
||||
|
||||
|
||||
@ -119,17 +119,27 @@ class ConfigControllerTest extends WallabagTestCase
|
||||
public function dataForUpdateFailed()
|
||||
{
|
||||
return [
|
||||
[[
|
||||
'config[items_per_page]' => '',
|
||||
'config[language]' => 'en',
|
||||
]],
|
||||
[
|
||||
[
|
||||
'config[items_per_page]' => '',
|
||||
'config[language]' => 'en',
|
||||
],
|
||||
'This value should not be blank',
|
||||
],
|
||||
[
|
||||
[
|
||||
'config[items_per_page]' => 0,
|
||||
'config[language]' => 'en',
|
||||
],
|
||||
'validator.item_per_page_too_low',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider dataForUpdateFailed
|
||||
*/
|
||||
public function testUpdateFailed($data)
|
||||
public function testUpdateFailed($data, $expectedMessage)
|
||||
{
|
||||
$this->logInAs('admin');
|
||||
$client = $this->getTestClient();
|
||||
@ -145,7 +155,7 @@ class ConfigControllerTest extends WallabagTestCase
|
||||
$this->assertSame(200, $client->getResponse()->getStatusCode());
|
||||
|
||||
$this->assertGreaterThan(1, $alert = $crawler->filter('body')->extract(['_text']));
|
||||
$this->assertStringContainsString('This value should not be blank', $alert[0]);
|
||||
$this->assertStringContainsString($expectedMessage, $alert[0]);
|
||||
}
|
||||
|
||||
public function dataForChangePasswordFailed()
|
||||
@ -400,7 +410,7 @@ class ConfigControllerTest extends WallabagTestCase
|
||||
[
|
||||
'feed_config[feed_limit]' => 0,
|
||||
],
|
||||
'This value should be between 1 and 100000.',
|
||||
'validator.feed_limit_too_low',
|
||||
],
|
||||
[
|
||||
[
|
||||
|
||||
@ -2,6 +2,8 @@ validator:
|
||||
password_must_match: The passwords must match.
|
||||
password_too_short: Your password must be at least 8 characters.
|
||||
password_wrong_value: Wrong current password supplied.
|
||||
item_per_page_too_low: This value should be greater than or equal to 1.
|
||||
item_per_page_too_high: This will certainly kill the app
|
||||
feed_limit_too_low: This value should be greater than or equal to 1.
|
||||
feed_limit_too_high: This will certainly kill the app
|
||||
quote_length_too_high: The quote is too long. It should have {{ limit }} characters or less.
|
||||
|
||||
@ -2,6 +2,8 @@ validator:
|
||||
password_must_match: Les deux mots de passe doivent correspondre.
|
||||
password_too_short: Votre mot de passe doit faire au moins 8 caractères.
|
||||
password_wrong_value: Mot de passe fourni incorrect.
|
||||
item_per_page_too_low: Cette valeur doit être supérieure ou égale à 1.
|
||||
item_per_page_too_high: Ça ne va pas plaire à l’application
|
||||
feed_limit_too_low: Cette valeur doit être supérieure ou égale à 1.
|
||||
feed_limit_too_high: Ça ne va pas plaire à l’application
|
||||
quote_length_too_high: La citation est trop longue. Elle doit avoir au maximum {{ limit }} caractères.
|
||||
|
||||
Reference in New Issue
Block a user