Skip to content

Commit e166d69

Browse files
committed
Merge branch '2.8'
* 2.8: [#5472] Minor tweak and adding code example [#5453] Minor tweaks - mostly thanks to Javier Reword Fix moving the mapped down as per @xabbuh Fix caching Fix build Fix the rendering issue Fix issues reported by @snoek09 . Thank you. Added a tip about hashing the result of nextBytes() Make the necessary changes mentioned by @xabbuh and add example for form rework the quick tour's big picture fix for Symfony 2.7 Fix after install URL and new photo since AcmeDemoBundle is not part of 2.7 Starting with range documentation Improve travis build speed
2 parents b77b148 + befbf7b commit e166d69

File tree

9 files changed

+110
-26
lines changed

9 files changed

+110
-26
lines changed

.travis.yml

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
language: python
22

3-
python:
4-
- "2.7"
3+
python: "2.7"
54

65
sudo: false
76

8-
install:
9-
- "pip install -q -r requirements.txt --use-mirrors"
7+
cache:
8+
directories:
9+
- $HOME/.cache/pip
10+
- _build
11+
12+
install: pip install sphinx==1.1.3
1013

1114
script: sphinx-build -nW -b html -d _build/doctrees . _build/html
1215

1316
branches:
1417
except:
1518
- github-comments
16-

book/security.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -994,7 +994,7 @@ other users. Also, as the admin user, you yourself want to be able to edit
994994

995995
To accomplish this you have 2 options:
996996

997-
* :doc:`Voters </cookbook/security/voters>` allow you to use business logic
997+
* :doc:`Voters </cookbook/security/voters>` allow you to write own business logic
998998
(e.g. the user can edit this post because they were the creator) to determine
999999
access. You'll probably want this option - it's flexible enough to solve the
10001000
above situation.

components/security/secure_tools.rst

+12-2
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,21 @@ to work correctly. Just pass a file name to enable it::
5050
use Symfony\Component\Security\Core\Util\SecureRandom;
5151

5252
$generator = new SecureRandom('/some/path/to/store/the/seed.txt');
53+
5354
$random = $generator->nextBytes(10);
55+
$hashedRandom = md5($random); // see tip below
5456

5557
.. note::
5658

57-
If you're using the Symfony Framework, you can access a secure random
58-
instance directly from the container: its name is ``security.secure_random``.
59+
If you're using the Symfony Framework, you can get a secure random number
60+
generator via the ``security.secure_random`` service.
61+
62+
.. tip::
63+
64+
The ``nextBytes()`` method returns a binary string which may contain the
65+
``\0`` character. This can cause trouble in several common scenarios, such
66+
as storing this value in a database or including it as part of the URL. The
67+
solution is to hash the value returned by ``nextBytes()`` (to do that, you
68+
can use a simple ``md5()`` PHP function).
5969

6070
.. _`Timing attack`: http://en.wikipedia.org/wiki/Timing_attack

cookbook/security/voters.rst

+3-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@ All voters are called each time you use the ``isGranted()`` method on Symfony's
2828
authorization checker (i.e. the ``security.authorization_checker`` service). Each
2929
one decides if the current user should have access to some resource.
3030

31-
Ultimately, Symfony uses one of three different approaches on what to do
32-
with the feedback from all voters: affirmative, consensus and unanimous.
31+
Ultimately, Symfony takes the responses from all voters and makes the final
32+
decission (to allow or deny access to the resource) according to the strategy defined
33+
in the application, which can be: affirmative, consensus or unanimous.
3334

3435
For more information take a look at
3536
:ref:`the section about access decision managers <components-security-access-decision-manager>`.

quick_tour/the_big_picture.rst

+11-15
Original file line numberDiff line numberDiff line change
@@ -106,20 +106,16 @@ Congratulations! Your first Symfony project is up and running!
106106
them are explained in the
107107
:ref:`Setting up Permissions <book-installation-permissions>` section
108108
of the official book.
109-
109+
110110
If the welcome page does not seem to be rendering CSS or image assets,
111111
install them first:
112-
112+
113113
.. code-block:: bash
114-
114+
115115
$ php app/console assets:install
116116
117117
When you are finished working on your Symfony application, you can stop
118-
the server with the ``server:stop`` command:
119-
120-
.. code-block:: bash
121-
122-
$ php app/console server:stop
118+
the server by pressing Ctrl and C.
123119

124120
.. tip::
125121

@@ -135,15 +131,15 @@ of database calls, HTML tags and other PHP code in the same script. To achieve
135131
this goal with Symfony, you'll first need to learn a few fundamental concepts.
136132

137133
When developing a Symfony application, your responsibility as a developer
138-
is to write the code that maps the user's *request* (e.g. ``http://localhost:8000/``)
139-
to the *resource* associated with it (the ``Welcome to Symfony!`` HTML page).
134+
is to write the code that maps the user's *request* (e.g. ``http://localhost:8000/app/example``)
135+
to the *resource* associated with it (the ``Homepage`` HTML page).
140136

141137
The code to execute is defined in **actions** and **controllers**. The mapping
142138
between user's requests and that code is defined via the **routing** configuration.
143139
And the contents displayed in the browser are usually rendered using **templates**.
144140

145-
When you browsed ``http://localhost:8000/`` earlier, Symfony executed the
146-
controller defined in the ``src/AppBundle/Controller/DefaultController.php``
141+
When you browsed ``http://localhost:8000/app/example`` earlier, Symfony executed
142+
the controller defined in the ``src/AppBundle/Controller/DefaultController.php``
147143
file and rendered the ``app/Resources/views/default/index.html.twig`` template.
148144
In the following sections you'll learn in detail the inner workings of Symfony
149145
controllers, routes and templates.
@@ -186,7 +182,7 @@ information and then they render a template to show the results to the user.
186182

187183
In this example, the ``index`` action is practically empty because it doesn't
188184
need to call any other method. The action just renders a template with the
189-
*Welcome to Symfony!* content.
185+
*Homepage.* content.
190186

191187
Routing
192188
~~~~~~~
@@ -221,8 +217,8 @@ start with ``/**``, whereas regular PHP comments start with ``/*``.
221217
The first value of ``@Route()`` defines the URL that will trigger the execution
222218
of the action. As you don't have to add the host of your application to
223219
the URL (e.g. ```http://example.com``), these URLs are always relative and
224-
they are usually called *paths*. In this case, the ``/`` path refers to
225-
the application homepage. The second value of ``@Route()`` (e.g.
220+
they are usually called *paths*. In this case, the ``/app/example`` path
221+
refers to the application homepage. The second value of ``@Route()`` (e.g.
226222
``name="homepage"``) is optional and sets the name of this route. For now
227223
this name is not needed, but later it'll be useful for linking pages.
228224

reference/forms/types.rst

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Form Types Reference
1818
types/percent
1919
types/search
2020
types/url
21+
types/range
2122

2223
types/choice
2324
types/entity

reference/forms/types/map.rst.inc

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Text Fields
1111
* :doc:`percent </reference/forms/types/percent>`
1212
* :doc:`search </reference/forms/types/search>`
1313
* :doc:`url </reference/forms/types/url>`
14+
* :doc:`range </reference/forms/types/range>`
1415

1516
Choice Fields
1617
~~~~~~~~~~~~~

reference/forms/types/range.rst

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
.. index::
2+
single: Forms; Fields; range
3+
4+
range Field Type
5+
================
6+
7+
The ``range`` field is a slider that is rendered using the HTML5
8+
``<input type="range" />`` tag.
9+
10+
+-------------+---------------------------------------------------------------------+
11+
| Rendered as | ``input`` ``range`` field (slider in HTML5 supported browser) |
12+
+-------------+---------------------------------------------------------------------+
13+
| Inherited | - `attr`_ |
14+
| options | - `data`_ |
15+
| | - `disabled`_ |
16+
| | - `empty_data`_ |
17+
| | - `error_bubbling`_ |
18+
| | - `error_mapping`_ |
19+
| | - `label`_ |
20+
| | - `label_attr`_ |
21+
| | - `mapped`_ |
22+
| | - `required`_ |
23+
| | - `trim`_ |
24+
+-------------+---------------------------------------------------------------------+
25+
| Parent type | :doc:`text </reference/forms/types/text>` |
26+
+-------------+---------------------------------------------------------------------+
27+
| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\RangeType` |
28+
+-------------+---------------------------------------------------------------------+
29+
30+
Basic Usage
31+
-----------
32+
33+
.. code-block:: php
34+
35+
$builder->add('name', 'range', array(
36+
'attr' => array(
37+
'min' => 5,
38+
'max' => 50
39+
)
40+
));
41+
42+
Inherited Options
43+
-----------------
44+
45+
These options inherit from the :doc:`form </reference/forms/types/form>`
46+
type:
47+
48+
.. include:: /reference/forms/types/options/attr.rst.inc
49+
50+
.. include:: /reference/forms/types/options/data.rst.inc
51+
52+
.. include:: /reference/forms/types/options/disabled.rst.inc
53+
54+
.. include:: /reference/forms/types/options/empty_data.rst.inc
55+
:end-before: DEFAULT_PLACEHOLDER
56+
57+
The default value is ``''`` (the empty string).
58+
59+
.. include:: /reference/forms/types/options/empty_data.rst.inc
60+
:start-after: DEFAULT_PLACEHOLDER
61+
62+
.. include:: /reference/forms/types/options/error_bubbling.rst.inc
63+
64+
.. include:: /reference/forms/types/options/error_mapping.rst.inc
65+
66+
.. include:: /reference/forms/types/options/label.rst.inc
67+
68+
.. include:: /reference/forms/types/options/label_attr.rst.inc
69+
70+
.. include:: /reference/forms/types/options/mapped.rst.inc
71+
72+
.. include:: /reference/forms/types/options/required.rst.inc
73+
74+
.. include:: /reference/forms/types/options/trim.rst.inc

requirements.txt

-1
This file was deleted.

0 commit comments

Comments
 (0)