Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 5f77c3f

Browse filesBrowse files
committed
Merge branch '6.3' into 6.4
* 6.3: [Validator] Add missing Spanish (es) translations #51956 Add missing dutch translations [WebProfilerBundle] Fix markup to make link to profiler appear on errored WDT [Translation][Validator] Add missing translations for Russian (104 - 109) [Translation][Validator] Add missing translations for Japanese (104 - 109) [Translation] remove blank line [Translation][Validator] Add missing translations for pt_BR (104-109) Fix the link to the docs [Validator] Add missing Persian(fa) translations [PhpUnitBridge] Fix typo Add keyword `dev` to leverage composer hint [RateLimiter] TokenBucket policy fix for adding tokens with a predefined frequency
2 parents 732ef57 + 80ab630 commit 5f77c3f
Copy full SHA for 5f77c3f

File tree

11 files changed

+196
-11
lines changed
Filter options

11 files changed

+196
-11
lines changed

‎src/Symfony/Bridge/PhpUnit/composer.json

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/PhpUnit/composer.json
+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "symfony/phpunit-bridge",
33
"type": "symfony-bridge",
44
"description": "Provides utilities for PHPUnit, especially user deprecation notices management",
5-
"keywords": [],
5+
"keywords": ["dev"],
66
"homepage": "https://symfony.com",
77
"license": "MIT",
88
"authors": [

‎src/Symfony/Component/RateLimiter/Policy/Rate.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/RateLimiter/Policy/Rate.php
+12
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,18 @@ public function calculateNewTokensDuringInterval(float $duration): int
9999
return $cycles * $this->refillAmount;
100100
}
101101

102+
/**
103+
* Calculates total amount in seconds of refill intervals during $duration (for maintain strict refill frequency).
104+
*
105+
* @param float $duration interval in seconds
106+
*/
107+
public function calculateRefillInterval(float $duration): int
108+
{
109+
$cycleTime = TimeUtil::dateIntervalToSeconds($this->refillTime);
110+
111+
return floor($duration / $cycleTime) * $cycleTime;
112+
}
113+
102114
public function __toString(): string
103115
{
104116
return $this->refillTime->format('P%yY%mM%dDT%HH%iM%sS').'-'.$this->refillAmount;

‎src/Symfony/Component/RateLimiter/Policy/TokenBucket.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/RateLimiter/Policy/TokenBucket.php
+6-1
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,13 @@ public function setTokens(int $tokens): void
6767
public function getAvailableTokens(float $now): int
6868
{
6969
$elapsed = max(0, $now - $this->timer);
70+
$newTokens = $this->rate->calculateNewTokensDuringInterval($elapsed);
7071

71-
return min($this->burstSize, $this->tokens + $this->rate->calculateNewTokensDuringInterval($elapsed));
72+
if ($newTokens > 0) {
73+
$this->timer += $this->rate->calculateRefillInterval($elapsed);
74+
}
75+
76+
return min($this->burstSize, $this->tokens + $newTokens);
7277
}
7378

7479
public function getExpirationTime(): int

‎src/Symfony/Component/RateLimiter/Policy/TokenBucketLimiter.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/RateLimiter/Policy/TokenBucketLimiter.php
-2
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ public function reserve(int $tokens = 1, float $maxTime = null): Reservation
7070
if ($availableTokens >= max(1, $tokens)) {
7171
// tokens are now available, update bucket
7272
$bucket->setTokens($availableTokens - $tokens);
73-
$bucket->setTimer($now);
7473

7574
$reservation = new Reservation($now, new RateLimit($bucket->getAvailableTokens($now), \DateTimeImmutable::createFromFormat('U', floor($now)), true, $this->maxBurst));
7675
} else {
@@ -87,7 +86,6 @@ public function reserve(int $tokens = 1, float $maxTime = null): Reservation
8786
// at $now + $waitDuration all tokens will be reserved for this process,
8887
// so no tokens are left for other processes.
8988
$bucket->setTokens($availableTokens - $tokens);
90-
$bucket->setTimer($now);
9189

9290
$reservation = new Reservation($now + $waitDuration, new RateLimit(0, \DateTimeImmutable::createFromFormat('U', floor($now + $waitDuration)), false, $this->maxBurst));
9391
}

‎src/Symfony/Component/RateLimiter/Tests/Policy/TokenBucketLimiterTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/RateLimiter/Tests/Policy/TokenBucketLimiterTest.php
+26
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,32 @@ public function testPeekConsume()
141141
}
142142
}
143143

144+
public function testBucketRefilledWithStrictFrequency()
145+
{
146+
$limiter = $this->createLimiter(1000, new Rate(\DateInterval::createFromDateString('15 seconds'), 100));
147+
$rateLimit = $limiter->consume(300);
148+
149+
$this->assertTrue($rateLimit->isAccepted());
150+
$this->assertEquals(700, $rateLimit->getRemainingTokens());
151+
152+
$expected = 699;
153+
154+
for ($i = 1; $i <= 20; ++$i) {
155+
$rateLimit = $limiter->consume();
156+
$this->assertTrue($rateLimit->isAccepted());
157+
$this->assertEquals($expected, $rateLimit->getRemainingTokens());
158+
159+
sleep(4);
160+
--$expected;
161+
162+
if (\in_array($i, [4, 8, 12], true)) {
163+
$expected += 100;
164+
} elseif (\in_array($i, [15, 19], true)) {
165+
$expected = 999;
166+
}
167+
}
168+
}
169+
144170
private function createLimiter($initialTokens = 10, Rate $rate = null)
145171
{
146172
return new TokenBucketLimiter('test', $initialTokens, $rate ?? Rate::perSecond(10), $this->storage);

‎src/Symfony/Component/Validator/Resources/translations/validators.es.xlf

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Resources/translations/validators.es.xlf
+31-7
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@
4040
</trans-unit>
4141
<trans-unit id="10">
4242
<source>This field is missing.</source>
43-
<target>Este campo está desaparecido.</target>
43+
<target>Este campo falta.</target>
4444
</trans-unit>
4545
<trans-unit id="11">
4646
<source>This value is not a valid date.</source>
4747
<target>Este valor no es una fecha válida.</target>
4848
</trans-unit>
4949
<trans-unit id="12">
5050
<source>This value is not a valid datetime.</source>
51-
<target>Este valor no es una fecha y hora válidas.</target>
51+
<target>Este valor no es una fecha y hora válida.</target>
5252
</trans-unit>
5353
<trans-unit id="13">
5454
<source>This value is not a valid email address.</source>
@@ -184,11 +184,11 @@
184184
</trans-unit>
185185
<trans-unit id="49">
186186
<source>The file was only partially uploaded.</source>
187-
<target>El archivo fue sólo subido parcialmente.</target>
187+
<target>El archivo se cargó solo parcialmente.</target>
188188
</trans-unit>
189189
<trans-unit id="50">
190190
<source>No file was uploaded.</source>
191-
<target>Ningún archivo fue subido.</target>
191+
<target>No se subió ningún archivo.</target>
192192
</trans-unit>
193193
<trans-unit id="51">
194194
<source>No temporary folder was configured in php.ini.</source>
@@ -200,7 +200,7 @@
200200
</trans-unit>
201201
<trans-unit id="53">
202202
<source>A PHP extension caused the upload to fail.</source>
203-
<target>Una extensión de PHP hizo que la subida fallara.</target>
203+
<target>Una extensión de PHP provocó que la carga fallara.</target>
204204
</trans-unit>
205205
<trans-unit id="54">
206206
<source>This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more.</source>
@@ -300,7 +300,7 @@
300300
</trans-unit>
301301
<trans-unit id="78">
302302
<source>An empty file is not allowed.</source>
303-
<target>No está permitido un archivo vacío.</target>
303+
<target>No se permite un archivo vacío.</target>
304304
</trans-unit>
305305
<trans-unit id="79">
306306
<source>The host could not be resolved.</source>
@@ -360,7 +360,7 @@
360360
</trans-unit>
361361
<trans-unit id="93">
362362
<source>This password has been leaked in a data breach, it must not be used. Please use another password.</source>
363-
<target>Esta contraseña no se puede utilizar porque está incluida en un listado de contraseñas públicas obtenido gracias a fallos de seguridad de otros sitios y aplicaciones. Por favor utilice otra contraseña.</target>
363+
<target>Esta contraseña no se puede utilizar porque está incluida en un listado de contraseñas públicas obtenido gracias a fallos de seguridad de otros sitios y aplicaciones. Por favor, utilice otra contraseña.</target>
364364
</trans-unit>
365365
<trans-unit id="94">
366366
<source>This value should be between {{ min }} and {{ max }}.</source>
@@ -402,6 +402,30 @@
402402
<source>The value of the netmask should be between {{ min }} and {{ max }}.</source>
403403
<target>El valor de la máscara de red debería estar entre {{ min }} y {{ max }}.</target>
404404
</trans-unit>
405+
<trans-unit id="104">
406+
<source>The filename is too long. It should have {{ filename_max_length }} character or less.|The filename is too long. It should have {{ filename_max_length }} characters or less.</source>
407+
<target>El nombre del archivo es demasido largo. Debe tener {{ filename_max_length }} carácter o menos.|El nombre del archivo es demasido largo. Debe tener {{ filename_max_length }} caracteres o menos.</target>
408+
</trans-unit>
409+
<trans-unit id="105">
410+
<source>The password strength is too low. Please use a stronger password.</source>
411+
<target>La seguridad de la contraseña es demasiado baja. Por favor, utilice una contraseña más segura.</target>
412+
</trans-unit>
413+
<trans-unit id="106">
414+
<source>This value contains characters that are not allowed by the current restriction-level.</source>
415+
<target>Este valor contiene caracteres que no están permitidos según el nivel de restricción actual.</target>
416+
</trans-unit>
417+
<trans-unit id="107">
418+
<source>Using invisible characters is not allowed.</source>
419+
<target>No se permite el uso de caracteres invisibles.</target>
420+
</trans-unit>
421+
<trans-unit id="108">
422+
<source>Mixing numbers from different scripts is not allowed.</source>
423+
<target>No está permitido mezclar números de diferentes scripts.</target>
424+
</trans-unit>
425+
<trans-unit id="109">
426+
<source>Using hidden overlay characters is not allowed.</source>
427+
<target>No está permitido el uso de caracteres superpuestos ocultos.</target>
428+
</trans-unit>
405429
</body>
406430
</file>
407431
</xliff>

‎src/Symfony/Component/Validator/Resources/translations/validators.fa.xlf

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Resources/translations/validators.fa.xlf
+24
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,30 @@
402402
<source>The value of the netmask should be between {{ min }} and {{ max }}.</source>
403403
<target>مقدار ماسک شبکه (NetMask) باید بین {{ min }} و {{ max }} باشد.</target>
404404
</trans-unit>
405+
<trans-unit id="104">
406+
<source>The filename is too long. It should have {{ filename_max_length }} character or less.|The filename is too long. It should have {{ filename_max_length }} characters or less.</source>
407+
<target>نام فایل طولانی است. نام فایل باید {{ filename_max_length }} کاراکتر یا کمتر باشد.|نام فایل طولانی است. نام فایل باید {{ filename_max_length }} کاراکتر یا کمتر باشد.</target>
408+
</trans-unit>
409+
<trans-unit id="105">
410+
<source>The password strength is too low. Please use a stronger password.</source>
411+
<target>رمز عبور ضعیف است. لطفا از رمز عبور قوی‌تری استفاده کنید.</target>
412+
</trans-unit>
413+
<trans-unit id="106">
414+
<source>This value contains characters that are not allowed by the current restriction-level.</source>
415+
<target>این مقدار حاوی کاراکترهایی است که در سطح محدودیت فعلی مجاز نیستند.</target>
416+
</trans-unit>
417+
<trans-unit id="107">
418+
<source>Using invisible characters is not allowed.</source>
419+
<target>استفاده از کاراکترهای نامرئی مجاز نمی‌باشد.</target>
420+
</trans-unit>
421+
<trans-unit id="108">
422+
<source>Mixing numbers from different scripts is not allowed.</source>
423+
<target>مخلوط کردن اعداد از اسکریپت های مختلف مجاز نیست.</target>
424+
</trans-unit>
425+
<trans-unit id="109">
426+
<source>Using hidden overlay characters is not allowed.</source>
427+
<target>استفاده از کاراکترهای همپوشانی پنهان (hidden overlay characters) مجاز نیست.</target>
428+
</trans-unit>
405429
</body>
406430
</file>
407431
</xliff>

‎src/Symfony/Component/Validator/Resources/translations/validators.ja.xlf

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Resources/translations/validators.ja.xlf
+24
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,30 @@
402402
<source>The value of the netmask should be between {{ min }} and {{ max }}.</source>
403403
<target>ネットマスクの値は、{{ min }}から{{ max }}の間にある必要があります。</target>
404404
</trans-unit>
405+
<trans-unit id="104">
406+
<source>The filename is too long. It should have {{ filename_max_length }} character or less.|The filename is too long. It should have {{ filename_max_length }} characters or less.</source>
407+
<target>ファイル名が長すぎます。ファイル名の長さは{{ filename_max_length }}文字以下でなければなりません。</target>
408+
</trans-unit>
409+
<trans-unit id="105">
410+
<source>The password strength is too low. Please use a stronger password.</source>
411+
<target>パスワードの強度が弱すぎます。より強いパスワードを使用してください。</target>
412+
</trans-unit>
413+
<trans-unit id="106">
414+
<source>This value contains characters that are not allowed by the current restriction-level.</source>
415+
<target>この値は現在の制限レベルで許可されていない文字を含んでいます。</target>
416+
</trans-unit>
417+
<trans-unit id="107">
418+
<source>Using invisible characters is not allowed.</source>
419+
<target>不可視文字は使用できません。</target>
420+
</trans-unit>
421+
<trans-unit id="108">
422+
<source>Mixing numbers from different scripts is not allowed.</source>
423+
<target>異なる種類の数字を使うことはできません。</target>
424+
</trans-unit>
425+
<trans-unit id="109">
426+
<source>Using hidden overlay characters is not allowed.</source>
427+
<target>隠れたオーバレイ文字は使用できません。</target>
428+
</trans-unit>
405429
</body>
406430
</file>
407431
</xliff>

‎src/Symfony/Component/Validator/Resources/translations/validators.nl.xlf

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Resources/translations/validators.nl.xlf
+24
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,30 @@
402402
<source>The value of the netmask should be between {{ min }} and {{ max }}.</source>
403403
<target>De waarde van de netmask moet zich tussen {{ min }} en {{ max }} bevinden.</target>
404404
</trans-unit>
405+
<trans-unit id="104">
406+
<source>The filename is too long. It should have {{ filename_max_length }} character or less.|The filename is too long. It should have {{ filename_max_length }} characters or less.</source>
407+
<target>De bestandsnaam is te lang. Het moet {{ filename_max_length }} karakter of minder zijn.</target>
408+
</trans-unit>
409+
<trans-unit id="105">
410+
<source>The password strength is too low. Please use a stronger password.</source>
411+
<target>De wachtwoordsterkte is te laag. Gebruik alstublieft een sterker wachtwoord.</target>
412+
</trans-unit>
413+
<trans-unit id="106">
414+
<source>This value contains characters that are not allowed by the current restriction-level.</source>
415+
<target>Deze waarde bevat tekens die niet zijn toegestaan volgens het huidige beperkingsniveau.</target>
416+
</trans-unit>
417+
<trans-unit id="107">
418+
<source>Using invisible characters is not allowed.</source>
419+
<target>Het gebruik van onzichtbare tekens is niet toegestaan.</target>
420+
</trans-unit>
421+
<trans-unit id="108">
422+
<source>Mixing numbers from different scripts is not allowed.</source>
423+
<target>Het mengen van cijfers uit verschillende schriften is niet toegestaan.</target>
424+
</trans-unit>
425+
<trans-unit id="109">
426+
<source>Using hidden overlay characters is not allowed.</source>
427+
<target>Het gebruik van verborgen overlay-tekens is niet toegestaan.</target>
428+
</trans-unit>
405429
</body>
406430
</file>
407431
</xliff>

‎src/Symfony/Component/Validator/Resources/translations/validators.pt_BR.xlf

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Resources/translations/validators.pt_BR.xlf
+24
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,30 @@
402402
<source>The value of the netmask should be between {{ min }} and {{ max }}.</source>
403403
<target>O valor da máscara de rede deve estar entre {{ min }} e {{ max }}.</target>
404404
</trans-unit>
405+
<trans-unit id="104">
406+
<source>The filename is too long. It should have {{ filename_max_length }} character or less.|The filename is too long. It should have {{ filename_max_length }} characters or less.</source>
407+
<target>O nome do arquivo é muito longo. Deve ter {{ filename_max_length }} caractere ou menos.|O nome do arquivo é muito longo. Deve ter {{ filename_max_length }} caracteres ou menos.</target>
408+
</trans-unit>
409+
<trans-unit id="105">
410+
<source>The password strength is too low. Please use a stronger password.</source>
411+
<target>A força da senha é muito baixa. Por favor, use uma senha mais forte.</target>
412+
</trans-unit>
413+
<trans-unit id="106">
414+
<source>This value contains characters that are not allowed by the current restriction-level.</source>
415+
<target>Este valor contém caracteres que não são permitidos pelo nível de restrição atual.</target>
416+
</trans-unit>
417+
<trans-unit id="107">
418+
<source>Using invisible characters is not allowed.</source>
419+
<target>O uso de caracteres invisíveis não é permitido.</target>
420+
</trans-unit>
421+
<trans-unit id="108">
422+
<source>Mixing numbers from different scripts is not allowed.</source>
423+
<target>Misturar números de scripts diferentes não é permitido.</target>
424+
</trans-unit>
425+
<trans-unit id="109">
426+
<source>Using hidden overlay characters is not allowed.</source>
427+
<target>O uso de caracteres de sobreposição ocultos não é permitido.</target>
428+
</trans-unit>
405429
</body>
406430
</file>
407431
</xliff>

‎src/Symfony/Component/Validator/Resources/translations/validators.ru.xlf

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Resources/translations/validators.ru.xlf
+24
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,30 @@
402402
<source>The value of the netmask should be between {{ min }} and {{ max }}.</source>
403403
<target>Значение маски подсети должно быть от {{ min }} до {{ max }}.</target>
404404
</trans-unit>
405+
<trans-unit id="104">
406+
<source>The filename is too long. It should have {{ filename_max_length }} character or less.|The filename is too long. It should have {{ filename_max_length }} characters or less.</source>
407+
<target>Имя файла слишком длинное. Оно должно содержать {{ filename_max_length }} символ или меньше.|Имя файла слишком длинное. Оно должно содержать {{ filename_max_length }} символа или меньше.|Имя файла слишком длинное. Оно должно содержать {{ filename_max_length }} символов или меньше.</target>
408+
</trans-unit>
409+
<trans-unit id="105">
410+
<source>The password strength is too low. Please use a stronger password.</source>
411+
<target>Слишком низкая надёжность пароля. Пожалуйста, используйте более надёжный пароль.</target>
412+
</trans-unit>
413+
<trans-unit id="106">
414+
<source>This value contains characters that are not allowed by the current restriction-level.</source>
415+
<target>Значение содержит символы, запрещённые на текущем уровне ограничений.</target>
416+
</trans-unit>
417+
<trans-unit id="107">
418+
<source>Using invisible characters is not allowed.</source>
419+
<target>Использование невидимых символов запрещено.</target>
420+
</trans-unit>
421+
<trans-unit id="108">
422+
<source>Mixing numbers from different scripts is not allowed.</source>
423+
<target>Смешивание номеров из разных сценариев запрещено.</target>
424+
</trans-unit>
425+
<trans-unit id="109">
426+
<source>Using hidden overlay characters is not allowed.</source>
427+
<target>Использование невидимых символов наложения запрещено.</target>
428+
</trans-unit>
405429
</body>
406430
</file>
407431
</xliff>

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.