Skip to content

Commit 6ec93be

Browse files
Merge branch '7.2' into 7.3
* 7.2: [HttpClient] Fix processing a NativeResponse after its client has been reset [Security] Throw an explicit error when authenticating a token with a null user Update Sponsor Section for 7.2 with Sulu and Rector translation to hebrew
2 parents 04551ad + 91497dc commit 6ec93be

File tree

7 files changed

+91
-32
lines changed

7 files changed

+91
-32
lines changed

README.md

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,26 +17,21 @@ Installation
1717
Sponsor
1818
-------
1919

20-
Symfony 7.1 is [backed][27] by
21-
- [Rector][29]
22-
- [JoliCode][30]
23-
- [Les-Tilleuls.coop][31]
20+
Symfony 7.2 is [backed][27] by
21+
- [Sulu][29]
22+
- [Rector][30]
23+
24+
**Sulu** is the CMS for Symfony developers. It provides pre-built content-management
25+
features while giving developers the freedom to build, deploy, and maintain custom
26+
solutions using full-stack Symfony. Sulu is ideal for creating complex websites,
27+
integrating external tools, and building custom-built solutions.
2428

2529
**Rector** helps successful and growing companies to get the most of the code
2630
they already have. Including upgrading to the latest Symfony LTS. They deliver
2731
automated refactoring, reduce maintenance costs, speed up feature delivery, and
2832
transform legacy code into a strategic asset. They can handle the dirty work,
2933
so you can focus on the features.
3034

31-
**JoliCode** is a team of passionate developers and open-source lovers, with a
32-
strong expertise in PHP & Symfony technologies. They can help you build your
33-
projects using state-of-the-art practices.
34-
35-
**Les-Tilleuls.coop** is a team of 70+ Symfony experts who can help you design, develop and
36-
fix your projects. They provide a wide range of professional services including development,
37-
consulting, coaching, training and audits. They also are highly skilled in JS, Go and DevOps.
38-
They are a worker cooperative!
39-
4035
Help Symfony by [sponsoring][28] its development!
4136

4237
Documentation
@@ -101,6 +96,5 @@ and supported by [Symfony contributors][19].
10196
[26]: https://symfony.com/book
10297
[27]: https://symfony.com/backers
10398
[28]: https://symfony.com/sponsor
104-
[29]: https://getrector.com
105-
[30]: https://jolicode.com
106-
[31]: https://les-tilleuls.coop
99+
[29]: https://sulu.io
100+
[30]: https://getrector.com

src/Symfony/Component/HttpClient/Response/NativeResponse.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public function __construct(
8080
};
8181

8282
$this->canary = new Canary(static function () use ($multi, $id) {
83-
if (null !== ($host = $multi->openHandles[$id][6] ?? null) && 0 >= --$multi->hosts[$host]) {
83+
if (null !== ($host = $multi->openHandles[$id][6] ?? null) && isset($multi->hosts[$host]) && 0 >= --$multi->hosts[$host]) {
8484
unset($multi->hosts[$host]);
8585
}
8686
unset($multi->openHandles[$id], $multi->handlesActivity[$id]);
@@ -303,7 +303,7 @@ private static function perform(ClientState $multi, ?array &$responses = null):
303303

304304
$multi->handlesActivity[$i][] = null;
305305
$multi->handlesActivity[$i][] = $e;
306-
if (null !== ($host = $multi->openHandles[$i][6] ?? null) && 0 >= --$multi->hosts[$host]) {
306+
if (null !== ($host = $multi->openHandles[$i][6] ?? null) && isset($multi->hosts[$host]) && 0 >= --$multi->hosts[$host]) {
307307
unset($multi->hosts[$host]);
308308
}
309309
unset($multi->openHandles[$i]);

src/Symfony/Component/HttpClient/Tests/HttpClientTestCase.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -701,6 +701,19 @@ public function testPostToGetRedirect(int $status)
701701
$this->assertSame('/', $body['REQUEST_URI']);
702702
}
703703

704+
public function testResponseCanBeProcessedAfterClientReset()
705+
{
706+
$client = $this->getHttpClient(__FUNCTION__);
707+
$response = $client->request('GET', 'http://127.0.0.1:8057/timeout-body');
708+
$stream = $client->stream($response);
709+
710+
$response->getStatusCode();
711+
$client->reset();
712+
$stream->current();
713+
714+
$this->addToAssertionCount(1);
715+
}
716+
704717
public function testUnixSocket()
705718
{
706719
if (!file_exists('/var/run/docker.sock')) {

src/Symfony/Component/Security/Http/Firewall/ContextListener.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,10 @@ public function authenticate(RequestEvent $event): void
121121
]);
122122

123123
if ($token instanceof TokenInterface) {
124+
if (!$token->getUser()) {
125+
throw new \UnexpectedValueException(\sprintf('Cannot authenticate a "%s" token because it doesn\'t store a user.', $token::class));
126+
}
127+
124128
$originalToken = $token;
125129
$token = $this->refreshUser($token);
126130

src/Symfony/Component/Security/Http/Tests/Firewall/ContextListenerTest.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
use Symfony\Component\Security\Core\User\UserInterface;
3737
use Symfony\Component\Security\Core\User\UserProviderInterface;
3838
use Symfony\Component\Security\Http\Firewall\ContextListener;
39+
use Symfony\Component\Security\Http\Tests\Fixtures\NullUserToken;
3940
use Symfony\Contracts\Service\ServiceLocatorTrait;
4041

4142
class ContextListenerTest extends TestCase
@@ -58,6 +59,30 @@ public function testUserProvidersNeedToImplementAnInterface()
5859
$this->handleEventWithPreviousSession([new \stdClass()]);
5960
}
6061

62+
public function testTokenReturnsNullUser()
63+
{
64+
$tokenStorage = new TokenStorage();
65+
$tokenStorage->setToken(new NullUserToken());
66+
67+
$session = new Session(new MockArraySessionStorage());
68+
$session->set('_security_context_key', serialize($tokenStorage->getToken()));
69+
70+
$request = new Request();
71+
$request->setSession($session);
72+
$request->cookies->set('MOCKSESSID', true);
73+
74+
$listener = new ContextListener($tokenStorage, [], 'context_key');
75+
76+
$this->expectException(\UnexpectedValueException::class);
77+
$this->expectExceptionMessage('Cannot authenticate a "Symfony\Component\Security\Http\Tests\Fixtures\NullUserToken" token because it doesn\'t store a user.');
78+
79+
$listener->authenticate(new RequestEvent(
80+
$this->createMock(HttpKernelInterface::class),
81+
$request,
82+
HttpKernelInterface::MAIN_REQUEST,
83+
));
84+
}
85+
6186
public function testOnKernelResponseWillAddSession()
6287
{
6388
$session = $this->runSessionOnKernelResponse(
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\Security\Http\Tests\Fixtures;
13+
14+
use Symfony\Component\Security\Core\Authentication\Token\AbstractToken;
15+
use Symfony\Component\Security\Core\User\UserInterface;
16+
17+
class NullUserToken extends AbstractToken
18+
{
19+
public function getUser(): ?UserInterface
20+
{
21+
return null;
22+
}
23+
}

src/Symfony/Component/Validator/Resources/translations/validators.he.xlf

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@
136136
</trans-unit>
137137
<trans-unit id="37" resname="This is not a valid IP address.">
138138
<source>This value is not a valid IP address.</source>
139-
<target state="needs-review-translation">ערך זה אינו כתובת IP תקפה.</target>
139+
<target>ערך זה אינו כתובת IP תקפה.</target>
140140
</trans-unit>
141141
<trans-unit id="38">
142142
<source>This value is not a valid language.</source>
@@ -192,7 +192,7 @@
192192
</trans-unit>
193193
<trans-unit id="51" resname="No temporary folder was configured in php.ini.">
194194
<source>No temporary folder was configured in php.ini, or the configured folder does not exist.</source>
195-
<target state="needs-review-translation">לא הוגדרה תיקייה זמנית ב-php.ini, או שהתיקייה המוגדרת אינה קיימת.</target>
195+
<target>לא הוגדרה תיקייה זמנית ב-php.ini, או שהתיקייה המוגדרת אינה קיימת.</target>
196196
</trans-unit>
197197
<trans-unit id="52">
198198
<source>Cannot write temporary file to disk.</source>
@@ -224,7 +224,7 @@
224224
</trans-unit>
225225
<trans-unit id="59" resname="This is not a valid International Bank Account Number (IBAN).">
226226
<source>This value is not a valid International Bank Account Number (IBAN).</source>
227-
<target state="needs-review-translation">ערך זה אינו מספר חשבון בנק בינלאומי (IBAN) תקף.</target>
227+
<target>ערך זה אינו מספר זה"ב (IBAN) תקף.</target>
228228
</trans-unit>
229229
<trans-unit id="60">
230230
<source>This value is not a valid ISBN-10.</source>
@@ -312,15 +312,15 @@
312312
</trans-unit>
313313
<trans-unit id="81" resname="This is not a valid Business Identifier Code (BIC).">
314314
<source>This value is not a valid Business Identifier Code (BIC).</source>
315-
<target state="needs-review-translation">ערך זה אינו קוד מזהה עסקי (BIC) תקף.</target>
315+
<target>ערך זה אינו קוד מזהה עסקי (BIC) תקף.</target>
316316
</trans-unit>
317317
<trans-unit id="82">
318318
<source>Error</source>
319319
<target>שגיאה</target>
320320
</trans-unit>
321321
<trans-unit id="83" resname="This is not a valid UUID.">
322322
<source>This value is not a valid UUID.</source>
323-
<target state="needs-review-translation">ערך זה אינו UUID תקף.</target>
323+
<target>ערך זה אינו UUID תקף.</target>
324324
</trans-unit>
325325
<trans-unit id="84">
326326
<source>This value should be a multiple of {{ compared_value }}.</source>
@@ -404,39 +404,39 @@
404404
</trans-unit>
405405
<trans-unit id="104">
406406
<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 state="needs-review-translation">שם הקובץ ארוך מדי. עליו להכיל {{ filename_max_length }} תווים או פחות.</target>
407+
<target>שם הקובץ ארוך מדי. עליו להכיל {{ filename_max_length }} תווים או פחות.</target>
408408
</trans-unit>
409409
<trans-unit id="105">
410410
<source>The password strength is too low. Please use a stronger password.</source>
411-
<target state="needs-review-translation">חוזק הסיסמה נמוך מדי. אנא השתמש בסיסמה חזקה יותר.</target>
411+
<target>חוזק הסיסמה נמוך מדי. אנא השתמש בסיסמה חזקה יותר.</target>
412412
</trans-unit>
413413
<trans-unit id="106">
414414
<source>This value contains characters that are not allowed by the current restriction-level.</source>
415-
<target state="needs-review-translation">הערך כולל תווים שאינם מותרים על פי רמת ההגבלה הנוכחית.</target>
415+
<target>הערך כולל תווים שאינם מותרים על פי רמת ההגבלה הנוכחית.</target>
416416
</trans-unit>
417417
<trans-unit id="107">
418418
<source>Using invisible characters is not allowed.</source>
419-
<target state="needs-review-translation">אסור להשתמש בתווים בלתי נראים.</target>
419+
<target>אסור להשתמש בתווים בלתי נראים.</target>
420420
</trans-unit>
421421
<trans-unit id="108">
422422
<source>Mixing numbers from different scripts is not allowed.</source>
423-
<target state="needs-review-translation">אסור לערבב מספרים מתסריטים שונים.</target>
423+
<target>אסור לערבב מספרים מסקריפטים שונים.</target>
424424
</trans-unit>
425425
<trans-unit id="109">
426426
<source>Using hidden overlay characters is not allowed.</source>
427-
<target state="needs-review-translation">אסור להשתמש בתווים מוסתרים של חפיפה.</target>
427+
<target>אסור להשתמש בתווים חופפים נסתרים.</target>
428428
</trans-unit>
429429
<trans-unit id="110">
430430
<source>The extension of the file is invalid ({{ extension }}). Allowed extensions are {{ extensions }}.</source>
431-
<target state="needs-review-translation">סיומת הקובץ אינה תקינה ({{ extension }}). הסיומות המותרות הן {{ extensions }}.</target>
431+
<target>סיומת הקובץ אינה תקינה ({{ extension }}). הסיומות המותרות הן {{ extensions }}.</target>
432432
</trans-unit>
433433
<trans-unit id="111">
434434
<source>The detected character encoding is invalid ({{ detected }}). Allowed encodings are {{ encodings }}.</source>
435-
<target state="needs-review-translation">קידוד התווים שזוהה אינו חוקי ({{ detected }}). הקידודים המותרים הם {{ encodings }}.</target>
435+
<target>קידוד התווים שזוהה אינו חוקי ({{ detected }}). הקידודים המותרים הם {{ encodings }}.</target>
436436
</trans-unit>
437437
<trans-unit id="112">
438438
<source>This value is not a valid MAC address.</source>
439-
<target state="needs-review-translation">ערך זה אינו כתובת MAC תקפה.</target>
439+
<target>ערך זה אינו כתובת MAC תקפה.</target>
440440
</trans-unit>
441441
<trans-unit id="113">
442442
<source>This URL is missing a top-level domain.</source>

0 commit comments

Comments
 (0)