Skip to content

Commit f90dfb7

Browse files
committed
Merge branch '4.4'
* 4.4: [#12605] Transformed GET parameter notice to caution access_control.rst: query string is ignored [Console] Update some method names [mercure] compatibility with v0.8 Update doctrine.rst
2 parents 7d5a546 + 7da7c6c commit f90dfb7

File tree

5 files changed

+27
-22
lines changed

5 files changed

+27
-22
lines changed

components/console/helpers/progressbar.rst

+9-10
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ you can also set the current progress by calling the
5050

5151
If your platform doesn't support ANSI codes, updates to the progress
5252
bar are added as new lines. To prevent the output from being flooded,
53-
use the method :method:`Symfony\\Component\\Console\\Helper\\ProgressBar::preventRedrawFasterThan`
54-
(it writes to the output after every N seconds) and the method
53+
use the method :method:`Symfony\\Component\\Console\\Helper\\ProgressBar::minSecondsBetweenRedraws`
54+
to limit the number of redraws and the method
5555
:method:`Symfony\\Component\\Console\\Helper\\ProgressBar::setRedrawFrequency`
56-
(it writes to the output every N iterations). By default, redraw frequency is
56+
to redraw every N iterations. By default, redraw frequency is
5757
**100ms** or **10%** of your ``max``.
5858

5959
If you don't know the exact number of steps in advance, set it to a reasonable
@@ -287,19 +287,18 @@ to display it can be customized::
287287
.. caution::
288288

289289
For performance reasons, Symfony redraws screen every 100ms. If this is too
290-
fast or to slow for your application, use these methods:
291-
:method:`Symfony\\Component\\Console\\Helper\\ProgressBar::preventRedrawFasterThan`
292-
:method:`Symfony\\Component\\Console\\Helper\\ProgressBar::setRedrawFrequency`
293-
:method:`Symfony\\Component\\Console\\Helper\\ProgressBar::forceRedrawSlowerThan`::
290+
fast or to slow for your application, use the methods
291+
:method:`Symfony\\Component\\Console\\Helper\\ProgressBar::minSecondsBetweenRedraws` and
292+
:method:`Symfony\\Component\\Console\\Helper\\ProgressBar::maxSecondsBetweenRedraws`::
294293

295294
$progressBar = new ProgressBar($output, 50000);
296295
$progressBar->start();
297296

298297
// this redraws the screen every 100 iterations, but sets additional limits:
299-
// don't redraw slower than 100ms (0.1) or faster than 200ms (0.2)
298+
// don't redraw slower than 200ms (0.2) or faster than 100ms (0.1)
300299
$progressBar->setRedrawFrequency(100);
301-
$progressBar->forceRedrawSlowerThan(0.2);
302-
$progressBar->preventRedrawFasterThan(0.1);
300+
$progressBar->maxSecondsBetweenRedraws(0.2);
301+
$progressBar->minSecondsBetweenRedraws(0.1);
303302

304303
$i = 0;
305304
while ($i++ < 50000) {

components/mercure.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Usage
2828
The following example shows the component in action::
2929

3030
// change these values accordingly to your hub installation
31-
define('HUB_URL', 'https://demo.mercure.rocks/hub');
31+
define('HUB_URL', 'https://demo.mercure.rocks/.well-known/mercure');
3232
define('JWT', 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJtZXJjdXJlIjp7InN1YnNjcmliZSI6WyJmb28iLCJiYXIiXSwicHVibGlzaCI6WyJmb28iXX19.LRLvirgONK13JgacQ_VbcjySbVhkSmHy3IznH3tA9PM');
3333

3434
use Symfony\Component\Mercure\Jwt\StaticJwtProvider;

doctrine.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,7 @@ based on PHP conditions)::
751751
$qb = $this->createQueryBuilder('p')
752752
->where('p.price > :price')
753753
->setParameter('price', $price)
754-
->orderBy('p.price', 'ASC')
754+
->orderBy('p.price', 'ASC');
755755

756756
if (!$includeUnavailableProducts) {
757757
$qb->andWhere('p.available = TRUE')

mercure.rst

+10-10
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ Run the following command to start it:
7171

7272
.. code-block:: terminal
7373
74-
$ JWT_KEY='aVerySecretKey' ADDR='localhost:3000' ALLOW_ANONYMOUS=1 CORS_ALLOWED_ORIGINS=* ./mercure
74+
$ ./mercure --jwt-key='aVerySecretKey' --addr='localhost:3000' --allow-anonymous --cors-allowed-origins='*'
7575
7676
.. note::
7777

@@ -94,7 +94,7 @@ The preferred way to configure the MercureBundle is using
9494
Set the URL of your hub as the value of the ``MERCURE_PUBLISH_URL`` env var.
9595
The ``.env`` file of your project has been updated by the Flex recipe to
9696
provide example values.
97-
Set it to the URL of the Mercure Hub (``http://localhost:3000/hub`` by default).
97+
Set it to the URL of the Mercure Hub (``http://localhost:3000/.well-known/mercure`` by default).
9898

9999
In addition, the Symfony application must bear a `JSON Web Token`_ (JWT)
100100
to the Mercure Hub to be authorized to publish updates.
@@ -189,7 +189,7 @@ Subscribing to updates in JavaScript is straightforward:
189189

190190
.. code-block:: javascript
191191
192-
const eventSource = new EventSource('http://localhost:3000/hub?topic=' + encodeURIComponent('http://example.com/books/1'));
192+
const eventSource = new EventSource('http://localhost:3000/.well-known/mercure?topic=' + encodeURIComponent('http://example.com/books/1'));
193193
eventSource.onmessage = event => {
194194
// Will be called every time an update is published by the server
195195
console.log(JSON.parse(event.data));
@@ -201,7 +201,7 @@ and to use URI Templates as patterns:
201201
.. code-block:: javascript
202202
203203
// URL is a built-in JavaScript class to manipulate URLs
204-
const url = new URL('http://localhost:3000/hub');
204+
const url = new URL('http://localhost:3000/.well-known/mercure');
205205
url.searchParams.append('topic', 'http://example.com/books/1');
206206
// Subscribe to updates of several Book resources
207207
url.searchParams.append('topic', 'http://example.com/books/2');
@@ -295,7 +295,7 @@ by using the ``AbstractController::addLink`` helper method::
295295
// This parameter is automatically created by the MercureBundle
296296
$hubUrl = $this->getParameter('mercure.default_hub');
297297

298-
// Link: <http://localhost:3000/hub>; rel="mercure"
298+
// Link: <http://localhost:3000/.well-known/mercure>; rel="mercure"
299299
$this->addLink($request, new Link('mercure', $hubUrl));
300300

301301
return $this->json([
@@ -311,7 +311,7 @@ and to subscribe to it:
311311
.. code-block:: javascript
312312
313313
// Fetch the original resource served by the Symfony web API
314-
fetch('/books/1') // Has Link: <http://localhost:3000/hub>; rel="mercure"
314+
fetch('/books/1') // Has Link: <http://localhost:3000/.well-known/mercure>; rel="mercure"
315315
.then(response => {
316316
// Extract the hub URL from the Link header
317317
const hubUrl = response.headers.get('Link').match(/<([^>]+)>;\s+rel=(?:mercure|"[^"]*mercure[^"]*")/)[1];
@@ -420,7 +420,7 @@ And here is the controller::
420420
$response = $this->json(['@id' => '/demo/books/1', 'availability' => 'https://schema.org/InStock']);
421421
$response->headers->set(
422422
'set-cookie',
423-
sprintf('mercureAuthorization=%s; path=/hub; secure; httponly; SameSite=strict', $token)
423+
sprintf('mercureAuthorization=%s; path=/.well-known/mercure; secure; httponly; SameSite=strict', $token)
424424
);
425425

426426
return $response;
@@ -460,7 +460,7 @@ Then, reference this service in the bundle configuration:
460460
mercure:
461461
hubs:
462462
default:
463-
url: https://mercure-hub.example.com/hub
463+
url: https://mercure-hub.example.com/.well-known/mercure
464464
jwt_provider: App\Mercure\MyJwtProvider
465465
466466
.. code-block:: xml
@@ -470,7 +470,7 @@ Then, reference this service in the bundle configuration:
470470
<config>
471471
<hub
472472
name="default"
473-
url="https://mercure-hub.example.com/hub"
473+
url="https://mercure-hub.example.com/.well-known/mercure"
474474
jwt-provider="App\Mercure\MyJwtProvider"
475475
/>
476476
</config>
@@ -483,7 +483,7 @@ Then, reference this service in the bundle configuration:
483483
$container->loadFromExtension('mercure', [
484484
'hubs' => [
485485
'default' => [
486-
'url' => 'https://mercure-hub.example.com/hub',
486+
'url' => 'https://mercure-hub.example.com/.well-known/mercure',
487487
'jwt_provider' => MyJwtProvider::class,
488488
],
489489
],

security/access_control.rst

+6
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,12 @@ if ``ip``, ``port``, ``host`` or ``method`` are not specified for an entry, that
125125
| | | | | | | URI doesn't match any of the ``path`` values. |
126126
+-----------------+-------------+-------------+-------------+------------+--------------------------------+-------------------------------------------------------------+
127127

128+
.. caution::
129+
130+
Matching the URI is done without ``$_GET`` parameters.
131+
:ref:`Deny access in PHP code <security-securing-controller>` if you want
132+
to disallow access based on ``$_GET`` parameter values.
133+
128134
.. _security-access-control-enforcement-options:
129135

130136
2. Access Enforcement

0 commit comments

Comments
 (0)