Skip to content

Commit 8fbcd31

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents 20d3a3f + e166d69 commit 8fbcd31

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+1278
-829
lines changed

.platform.app.yaml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# This file describes an application. You can have multiple applications
2+
# in the same project.
3+
4+
# The name of this app. Must be unique within a project.
5+
name: symfonydocs
6+
7+
# The toolstack used to build the application.
8+
type: "php"
9+
10+
build:
11+
flavor: "composer"
12+
13+
# The configuration of app when it is exposed to the web.
14+
web:
15+
# The public directory of the app, relative to its root.
16+
document_root: "/_build/html"
17+
index_files:
18+
- index.html
19+
whitelist:
20+
- \.html$
21+
- \.txt$
22+
23+
# CSS and Javascript.
24+
- \.css$
25+
- \.js$
26+
- \.hbs$
27+
28+
# image/* types.
29+
- \.gif$
30+
- \.png$
31+
- \.ico$
32+
- \.svgz?$
33+
34+
# fonts types.
35+
- \.ttf$
36+
- \.eot$
37+
- \.woff$
38+
- \.otf$
39+
40+
# robots.txt.
41+
- /robots\.txt$
42+
43+
# The size of the persistent disk of the application (in MB).
44+
disk: 512
45+
46+
# Build time dependencies.
47+
dependencies:
48+
python:
49+
sphinx: ">=1"
50+
51+
# The hooks that will be performed when the package is deployed.
52+
hooks:
53+
build: |
54+
pip install git+https://github.com/fabpot/sphinx-php.git
55+
make html

.platform/routes.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
http://www.{default}/:
2+
to: http://{default}/
3+
type: redirect
4+
http://{default}/:
5+
cache:
6+
cookies:
7+
- '*'
8+
default_ttl: 0
9+
enabled: true
10+
headers:
11+
- Accept
12+
- Accept-Language
13+
ssi:
14+
enabled: false
15+
type: upstream
16+
upstream: symfonydocs:php

.platform/services.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Keeping this file empty to not deploy unused services.

.travis.yml

Lines changed: 7 additions & 5 deletions
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-

README.markdown

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,8 @@ Contributing
1414
We love contributors! For more information on how you can contribute to the
1515
Symfony documentation, please read
1616
[Contributing to the Documentation](https://symfony.com/doc/current/contributing/documentation/overview.html)
17+
18+
Platform.sh
19+
-----------
20+
21+
Pull requests are automatically built by [Platform.sh](https://platform.sh).

book/forms.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1145,6 +1145,8 @@ the choice is ultimately up to you.
11451145

11461146
$form->get('dueDate')->setData(new \DateTime());
11471147

1148+
.. _form-as-services:
1149+
11481150
Defining your Forms as Services
11491151
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
11501152

book/http_fundamentals.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,11 @@ delete a specific blog entry, for example:
9696
9797
.. note::
9898

99-
There are actually nine HTTP methods defined by the HTTP specification,
100-
but many of them are not widely used or supported. In reality, many modern
101-
browsers don't even support the ``PUT`` and ``DELETE`` methods.
99+
There are actually nine HTTP methods (also known as verbs) defined by
100+
the HTTP specification, but many of them are not widely used or supported.
101+
In reality, many modern browsers only support ``POST`` and ``GET`` in
102+
HTML forms. Various others are however supported in XMLHttpRequests,
103+
as well as by Symfony's router.
102104

103105
In addition to the first line, an HTTP request invariably contains other
104106
lines of information called request headers. The headers can supply a wide

book/installation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ based on `Composer`_.
127127

128128
Composer is the dependency manager used by modern PHP applications and it can
129129
also be used to create new applications based on the Symfony Framework. If you
130-
don't have installed it globally, start by reading the next section.
130+
don't have it installed globally, start by reading the next section.
131131

132132
Installing Composer Globally
133133
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

book/routing.rst

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -830,36 +830,36 @@ be accomplished with the following route configuration:
830830
class MainController extends Controller
831831
{
832832
/**
833-
* @Route("/contact")
833+
* @Route("/news")
834834
* @Method("GET")
835835
*/
836-
public function contactAction()
836+
public function newsAction()
837837
{
838-
// ... display contact form
838+
// ... display your news
839839
}
840840
841841
/**
842842
* @Route("/contact")
843-
* @Method("POST")
843+
* @Method({"GET", "POST"})
844844
*/
845-
public function processContactAction()
845+
public function contactFormAction()
846846
{
847-
// ... process contact form
847+
// ... display and process a contact form
848848
}
849849
}
850850
851851
.. code-block:: yaml
852852
853853
# app/config/routing.yml
854-
contact:
855-
path: /contact
856-
defaults: { _controller: AppBundle:Main:contact }
854+
news:
855+
path: /news
856+
defaults: { _controller: AppBundle:Main:news }
857857
methods: [GET]
858858
859-
contact_process:
859+
contact_form:
860860
path: /contact
861-
defaults: { _controller: AppBundle:Main:processContact }
862-
methods: [POST]
861+
defaults: { _controller: AppBundle:Main:contactForm }
862+
methods: [GET, POST]
863863
864864
.. code-block:: xml
865865
@@ -870,12 +870,12 @@ be accomplished with the following route configuration:
870870
xsi:schemaLocation="http://symfony.com/schema/routing
871871
http://symfony.com/schema/routing/routing-1.0.xsd">
872872
873-
<route id="contact" path="/contact" methods="GET">
874-
<default key="_controller">AppBundle:Main:contact</default>
873+
<route id="news" path="/news" methods="GET">
874+
<default key="_controller">AppBundle:Main:news</default>
875875
</route>
876876
877-
<route id="contact_process" path="/contact" methods="POST">
878-
<default key="_controller">AppBundle:Main:processContact</default>
877+
<route id="contact_form" path="/contact" methods="GET|POST">
878+
<default key="_controller">AppBundle:Main:contactForm</default>
879879
</route>
880880
</routes>
881881
@@ -886,13 +886,13 @@ be accomplished with the following route configuration:
886886
use Symfony\Component\Routing\Route;
887887
888888
$collection = new RouteCollection();
889-
$collection->add('contact', new Route('/contact', array(
889+
$collection->add('news', new Route('/news', array(
890890
'_controller' => 'AppBundle:Main:contact',
891891
), array(), array(), '', array(), array('GET')));
892892
893-
$collection->add('contact_process', new Route('/contact', array(
894-
'_controller' => 'AppBundle:Main:processContact',
895-
), array(), array(), '', array(), array('POST')));
893+
$collection->add('contact_form', new Route('/contact', array(
894+
'_controller' => 'AppBundle:Main:contactForm',
895+
), array(), array(), '', array(), array('GET', 'POST')));
896896
897897
return $collection;
898898

book/security.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -994,10 +994,10 @@ 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_data_permission>` allow you to
998-
use business logic (e.g. the user can edit this post because they were
999-
the creator) to determine access. You'll probably want this option - it's
1000-
flexible enough to solve the above situation.
997+
* :doc:`Voters </cookbook/security/voters>` allow you to write own business logic
998+
(e.g. the user can edit this post because they were the creator) to determine
999+
access. You'll probably want this option - it's flexible enough to solve the
1000+
above situation.
10011001

10021002
* :doc:`ACLs </cookbook/security/acl>` allow you to create a database structure
10031003
where you can assign *any* arbitrary user *any* access (e.g. EDIT, VIEW)
@@ -1378,7 +1378,7 @@ Learn More from the Cookbook
13781378

13791379
* :doc:`Forcing HTTP/HTTPS </cookbook/security/force_https>`
13801380
* :doc:`Impersonating a User </cookbook/security/impersonating_user>`
1381-
* :doc:`/cookbook/security/voters_data_permission`
1381+
* :doc:`/cookbook/security/voters`
13821382
* :doc:`Access Control Lists (ACLs) </cookbook/security/acl>`
13831383
* :doc:`/cookbook/security/remember_me`
13841384
* :doc:`/cookbook/security/multiple_user_providers`

components/console/introduction.rst

Lines changed: 35 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -175,22 +175,18 @@ Verbosity Levels
175175
The ``VERBOSITY_VERY_VERBOSE`` and ``VERBOSITY_DEBUG`` constants were introduced
176176
in version 2.3
177177

178-
The console has 5 levels of verbosity. These are defined in the
178+
The console has five verbosity levels. These are defined in the
179179
:class:`Symfony\\Component\\Console\\Output\\OutputInterface`:
180180

181-
======================================= ==================================
182-
Mode Value
183-
======================================= ==================================
184-
OutputInterface::VERBOSITY_QUIET Do not output any messages
185-
OutputInterface::VERBOSITY_NORMAL The default verbosity level
186-
OutputInterface::VERBOSITY_VERBOSE Increased verbosity of messages
187-
OutputInterface::VERBOSITY_VERY_VERBOSE Informative non essential messages
188-
OutputInterface::VERBOSITY_DEBUG Debug messages
189-
======================================= ==================================
190-
191-
You can specify the quiet verbosity level with the ``--quiet`` or ``-q``
192-
option. The ``--verbose`` or ``-v`` option is used when you want an increased
193-
level of verbosity.
181+
=========================================== ================================== =====================
182+
Value Meaning Console option
183+
=========================================== ================================== =====================
184+
``OutputInterface::VERBOSITY_QUIET`` Do not output any messages ``-q`` or ``--quiet``
185+
``OutputInterface::VERBOSITY_NORMAL`` The default verbosity level (none)
186+
``OutputInterface::VERBOSITY_VERBOSE`` Increased verbosity of messages ``-v``
187+
``OutputInterface::VERBOSITY_VERY_VERBOSE`` Informative non essential messages ``-vv``
188+
``OutputInterface::VERBOSITY_DEBUG`` Debug messages ``-vvv``
189+
=========================================== ================================== =====================
194190

195191
.. tip::
196192

@@ -223,6 +219,13 @@ verbosity levels::
223219
// ...
224220
}
225221

222+
.. note::
223+
224+
These semantic methods are defined in the ``OutputInterface`` starting from
225+
Symfony 3.0. In previous Symfony versions they are defined in the different
226+
implementations of the interface (e.g. :class:`Symfony\\Component\\Console\\Output\\Output`)
227+
in order to keep backwards compatibility.
228+
226229
When the quiet level is used, all output is suppressed as the default
227230
:method:`Symfony\\Component\\Console\\Output\\Output::write` method returns
228231
without actually printing.
@@ -477,6 +480,8 @@ method::
477480
You can also test a whole console application by using
478481
:class:`Symfony\\Component\\Console\\Tester\\ApplicationTester`.
479482

483+
.. _calling-existing-command:
484+
480485
Calling an Existing Command
481486
---------------------------
482487

@@ -506,16 +511,27 @@ Calling a command from another one is straightforward::
506511
}
507512

508513
First, you :method:`Symfony\\Component\\Console\\Application::find` the
509-
command you want to execute by passing the command name.
510-
511-
Then, you need to create a new
512-
:class:`Symfony\\Component\\Console\\Input\\ArrayInput` with the arguments and
513-
options you want to pass to the command.
514+
command you want to execute by passing the command name. Then, you need to create
515+
a new :class:`Symfony\\Component\\Console\\Input\\ArrayInput` with the arguments
516+
and options you want to pass to the command.
514517

515518
Eventually, calling the ``run()`` method actually executes the command and
516519
returns the returned code from the command (return value from command's
517520
``execute()`` method).
518521

522+
.. tip::
523+
524+
If you want to suppress the output of the executed command, pass a
525+
:class:`Symfony\\Component\\Console\\Output\\NullOutput` as the second
526+
argument to ``$command->execute()``.
527+
528+
.. caution::
529+
530+
Note that all the commands will run in the same process and some of Symfony's
531+
built-in commands may not work well this way. For instance, the ``cache:clear``
532+
and ``cache:warmup`` commands change some class definitions, so running
533+
something after them is likely to break.
534+
519535
.. note::
520536

521537
Most of the time, calling a command from code that is not executed on the

components/http_kernel/introduction.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,7 @@ can be used to check if the current request is a "master" or "sub" request.
692692
For example, a listener that only needs to act on the master request may
693693
look like this::
694694

695-
use Symfony\Component\HttpKernel\HttpKernelInterface;
695+
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
696696
// ...
697697

698698
public function onKernelRequest(GetResponseEvent $event)

components/security/secure_tools.rst

Lines changed: 12 additions & 2 deletions
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

0 commit comments

Comments
 (0)