Skip to content

Commit 85936a0

Browse files
committed
Merge branch '5.1'
* 5.1: Minor reword Fix bad example of lock Update dom_crawler.rst Update dom_crawler.rst Update service_subscribers_locators.rst Update http_client.rst Update framework.rst
2 parents e399144 + 8014552 commit 85936a0

File tree

5 files changed

+35
-16
lines changed

5 files changed

+35
-16
lines changed

components/dom_crawler.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ Using XPath expressions, you can select specific nodes within the document::
8888

8989
``DOMXPath::query`` is used internally to actually perform an XPath query.
9090

91-
If you prefer CSS selectors over XPath, install the CssSelector component.
92-
It allows you to use jQuery-like selectors to traverse::
91+
If you prefer CSS selectors over XPath, install :doc:`/components/css_selector`.
92+
It allows you to use jQuery-like selectors::
9393

9494
$crawler = $crawler->filter('body > p');
9595

@@ -105,12 +105,13 @@ An anonymous function can be used to filter with more complex criteria::
105105
return ($i % 2) == 0;
106106
});
107107

108-
To remove a node the anonymous function must return false.
108+
To remove a node, the anonymous function must return ``false``.
109109

110110
.. note::
111111

112112
All filter methods return a new :class:`Symfony\\Component\\DomCrawler\\Crawler`
113-
instance with filtered content.
113+
instance with the filtered content. To check if the filter actually
114+
found something, use ``$crawler->count() > 0`` on this new crawler.
114115

115116
Both the :method:`Symfony\\Component\\DomCrawler\\Crawler::filterXPath` and
116117
:method:`Symfony\\Component\\DomCrawler\\Crawler::filter` methods work with

components/lock.rst

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,9 @@ method, the resource will stay locked until the timeout::
113113
// create an expiring lock that lasts 30 seconds
114114
$lock = $factory->createLock('charts-generation', 30);
115115

116-
$lock->acquire();
116+
if (!$lock->acquire()) {
117+
return;
118+
}
117119
try {
118120
// perform a job during less than 30 seconds
119121
} finally {
@@ -132,7 +134,9 @@ to reset the TTL to its original value::
132134
// ...
133135
$lock = $factory->createLock('charts-generation', 30);
134136

135-
$lock->acquire();
137+
if (!$lock->acquire()) {
138+
return;
139+
}
136140
try {
137141
while (!$finished) {
138142
// perform a small part of the job.
@@ -495,7 +499,9 @@ Using the above methods, a more robust code would be::
495499
// ...
496500
$lock = $factory->createLock('invoice-publication', 30);
497501

498-
$lock->acquire();
502+
if (!$lock->acquire()) {
503+
return;
504+
}
499505
while (!$finished) {
500506
if ($lock->getRemainingLifetime() <= 5) {
501507
if ($lock->isExpired()) {

http_client.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,17 @@ according to the ``multipart/form-data`` content-type. The
623623
'body' => $formData->bodyToIterable(),
624624
]);
625625

626+
By default, HttpClient streams the body contents when uploading them. This might
627+
not work with all servers, resulting in HTTP status code 411 ("Length Required")
628+
because there is no ``Content-Length`` header. The solution is to turn the body
629+
into a string with the following method (which will increase memory consumption
630+
when the streams are large)::
631+
632+
$client->request('POST', 'https://...', [
633+
// ...
634+
'body' => $formData->bodyToString(),
635+
]);
636+
626637
Cookies
627638
~~~~~~~
628639

reference/configuration/framework.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -870,6 +870,14 @@ local_pk
870870
The path of a file that contains the `PEM formatted`_ private key of the
871871
certificate defined in the ``local_cert`` option.
872872

873+
max_duration
874+
............
875+
876+
**type**: ``float`` **default**: 0
877+
878+
The maximum execution time, in seconds, that the request and the response are
879+
allowed to take. A value lower than or equal to 0 means it is unlimited.
880+
873881
max_host_connections
874882
....................
875883

@@ -966,14 +974,6 @@ Time, in seconds, to wait for a response. If the response stales for longer, a
966974
Its default value is the same as the value of PHP's `default_socket_timeout`_
967975
config option.
968976

969-
max_duration
970-
............
971-
972-
**type**: ``float`` **default**: 0
973-
974-
The maximum execution time, in seconds, that the request and the response are
975-
allowed to take. A value lower than or equal to 0 means it is unlimited.
976-
977977
verify_host
978978
...........
979979

service_container/service_subscribers_locators.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,8 @@ will share identical locators among all the services referencing them::
383383

384384
use Symfony\Component\DependencyInjection\Compiler\ServiceLocatorTagPass;
385385
use Symfony\Component\DependencyInjection\ContainerBuilder;
386-
386+
use Symfony\Component\DependencyInjection\Reference;
387+
387388
public function process(ContainerBuilder $container)
388389
{
389390
// ...

0 commit comments

Comments
 (0)