Skip to content

Commit

Permalink
minor symfony#19691 Improve the formatting of the lists of special ch…
Browse files Browse the repository at this point in the history
…aracters (javiereguiluz)

This PR was merged into the 5.4 branch.

Discussion
----------

Improve the formatting of the lists of special characters

Fixes symfony#19686.

In addition to changing the formatting, I also added all the special chars defined in the related RFC: https://datatracker.ietf.org/doc/html/rfc3986#section-2.2

Commits
-------

c62331d Improve the formatting of the lists of special characters
  • Loading branch information
javiereguiluz committed Mar 21, 2024
2 parents 14c50b0 + c62331d commit a43d1a7
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 19 deletions.
5 changes: 2 additions & 3 deletions components/cache/cache_items.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ Cache Item Keys and Values
The **key** of a cache item is a plain string which acts as its
identifier, so it must be unique for each cache pool. You can freely choose the
keys, but they should only contain letters (A-Z, a-z), numbers (0-9) and the
``_`` and ``.`` symbols. Other common symbols (such as ``{``, ``}``, ``(``,
``)``, ``/``, ``\``, ``@`` and ``:``) are reserved by the PSR-6 standard for future
uses.
``_`` and ``.`` symbols. Other common symbols (such as ``{ } ( ) / \ @ :``) are
reserved by the PSR-6 standard for future uses.

The **value** of a cache item can be any data represented by a type which is
serializable by PHP, such as basic types (string, integer, float, boolean, null),
Expand Down
2 changes: 1 addition & 1 deletion doctrine.rst
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ The database connection information is stored as an environment variable called
.. caution::

If the username, password, host or database name contain any character considered
special in a URI (such as ``+``, ``@``, ``$``, ``#``, ``/``, ``:``, ``*``, ``!``, ``%``),
special in a URI (such as ``: / ? # [ ] @ ! $ & ' ( ) * + , ; =``),
you must encode them. See `RFC 3986`_ for the full list of reserved characters or
use the :phpfunction:`urlencode` function to encode them. In this case you need to
remove the ``resolve:`` prefix in ``config/packages/doctrine.yaml`` to avoid errors:
Expand Down
2 changes: 1 addition & 1 deletion mailer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ over SMTP by configuring the DSN in your ``.env`` file (the ``user``,
.. caution::

If the username, password or host contain any character considered special in a
URI (such as ``+``, ``@``, ``$``, ``#``, ``/``, ``:``, ``*``, ``!``), you must
URI (such as ``: / ? # [ ] @ ! $ & ' ( ) * + , ; =``), you must
encode them. See `RFC 3986`_ for the full list of reserved characters or use the
:phpfunction:`urlencode` function to encode them.

Expand Down
6 changes: 3 additions & 3 deletions notifier.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ SMS Channel
.. caution::

If any of the DSN values contains any character considered special in a
URI (such as ``+``, ``@``, ``$``, ``#``, ``/``, ``:``, ``*``, ``!``), you must
URI (such as ``: / ? # [ ] @ ! $ & ' ( ) * + , ; =``), you must
encode them. See `RFC 3986`_ for the full list of reserved characters or use the
:phpfunction:`urlencode` function to encode them.

Expand Down Expand Up @@ -211,7 +211,7 @@ Chat Channel
.. caution::

If any of the DSN values contains any character considered special in a
URI (such as ``+``, ``@``, ``$``, ``#``, ``/``, ``:``, ``*``, ``!``), you must
URI (such as ``: / ? # [ ] @ ! $ & ' ( ) * + , ; =``), you must
encode them. See `RFC 3986`_ for the full list of reserved characters or use the
:phpfunction:`urlencode` function to encode them.

Expand Down Expand Up @@ -415,7 +415,7 @@ Push Channel
.. caution::

If any of the DSN values contains any character considered special in a
URI (such as ``+``, ``@``, ``$``, ``#``, ``/``, ``:``, ``*``, ``!``), you must
URI (such as ``: / ? # [ ] @ ! $ & ' ( ) * + , ; =``), you must
encode them. See `RFC 3986`_ for the full list of reserved characters or use the
:phpfunction:`urlencode` function to encode them.

Expand Down
20 changes: 9 additions & 11 deletions reference/formats/yaml.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,10 @@ must be doubled to escape it:
'A single quote '' inside a single-quoted string'
Strings containing any of the following characters must be quoted. Although you
can use double quotes, for these characters it is more convenient to use single
quotes, which avoids having to escape any backslash ``\``:

* ``:``, ``{``, ``}``, ``[``, ``]``, ``,``, ``&``, ``*``, ``#``, ``?``, ``|``,
``-``, ``<``, ``>``, ``=``, ``!``, ``%``, ``@``, `````
Strings containing any of the following characters must be quoted:
``: { } [ ] , & * # ? | - < > = ! % @`` Although you can use double quotes, for
these characters it is more convenient to use single quotes, which avoids having
to escape any backslash ``\``.

The double-quoted style provides a way to express arbitrary strings, by
using ``\`` to escape characters and sequences. For instance, it is very useful
Expand All @@ -52,11 +50,11 @@ when you need to embed a ``\n`` or a Unicode character in a string.
If the string contains any of the following control characters, it must be
escaped with double quotes:

* ``\0``, ``\x01``, ``\x02``, ``\x03``, ``\x04``, ``\x05``, ``\x06``, ``\a``,
``\b``, ``\t``, ``\n``, ``\v``, ``\f``, ``\r``, ``\x0e``, ``\x0f``, ``\x10``,
``\x11``, ``\x12``, ``\x13``, ``\x14``, ``\x15``, ``\x16``, ``\x17``, ``\x18``,
``\x19``, ``\x1a``, ``\e``, ``\x1c``, ``\x1d``, ``\x1e``, ``\x1f``, ``\N``,
``\_``, ``\L``, ``\P``
``\0``, ``\x01``, ``\x02``, ``\x03``, ``\x04``, ``\x05``, ``\x06``, ``\a``,
``\b``, ``\t``, ``\n``, ``\v``, ``\f``, ``\r``, ``\x0e``, ``\x0f``, ``\x10``,
``\x11``, ``\x12``, ``\x13``, ``\x14``, ``\x15``, ``\x16``, ``\x17``, ``\x18``,
``\x19``, ``\x1a``, ``\e``, ``\x1c``, ``\x1d``, ``\x1e``, ``\x1f``, ``\N``,
``\_``, ``\L``, ``\P``

Finally, there are other cases when the strings must be quoted, no matter if
you're using single or double quotes:
Expand Down

0 comments on commit a43d1a7

Please sign in to comment.