Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5318f06

Browse files
committed
minor #9780 Documented the use of binary values as container params (javiereguiluz)
This PR was squashed before being merged into the 4.1 branch (closes #9780). Discussion ---------- Documented the use of binary values as container params This fixes #9650. Commits ------- 5125d50 Documented the use of binary values as container params
2 parents 7dc019e + 5125d50 commit 5318f06

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

service_container/parameters.rst

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,43 @@ Setting PHP constants as parameters is also supported:
284284
$container->setParameter('global.constant.value', GLOBAL_CONSTANT);
285285
$container->setParameter('my_class.constant.value', My_Class::CONSTANT_NAME);
286286
287+
Binary Values as Parameters
288+
---------------------------
289+
290+
.. versionadded:: 4.1
291+
The support for binary values in container parameters was introduced in
292+
Symfony 4.1
293+
294+
If the value of a container parameter is a binary value, set it as a base64
295+
encoded value in YAML and XML configs and use the escape sequences in PHP:
296+
297+
.. configuration-block::
298+
299+
.. code-block:: yaml
300+
301+
# config/services.yaml
302+
parameters:
303+
some_parameter: !!binary VGhpcyBpcyBhIEJlbGwgY2hhciAH
304+
305+
.. code-block:: xml
306+
307+
<!-- config/services.xml -->
308+
<?xml version="1.0" encoding="UTF-8" ?>
309+
<container xmlns="http://symfony.com/schema/dic/services"
310+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
311+
xsi:schemaLocation="http://symfony.com/schema/dic/services
312+
http://symfony.com/schema/dic/services/services-1.0.xsd">
313+
314+
<parameters>
315+
<parameter key="some_parameter" type="binary">VGhpcyBpcyBhIEJlbGwgY2hhciAH</parameter>
316+
</parameters>
317+
</container>
318+
319+
.. code-block:: php
320+
321+
// config/services.php
322+
$container->setParameter('some_parameter', 'This is a Bell char \x07');
323+
287324
PHP Keywords in XML
288325
-------------------
289326

0 commit comments

Comments
 (0)