Skip to content

Commit 30c036b

Browse files
committed
Merge branch '2.5'
* 2.5: A few small improvements to the EventDispatcher Component docs Fixes thanks to @xabbuh [#4295] Tweaking notes language Updated docblock for config in DEV environment. * Replaced IF statement by "internal" directive. * Splitted config for PROD and DEV environments. For Nginx in PROD env, this makes more difficult to know that app is running Symfony. app.php is widely known as our default front controller. It is a small effort by security through obscurity. For Apache, this 301 must be replaced by 404: https://github.com/symfony/symfony-standard/blob/77ee2a83c085169e0bd221510b5693dca504f682/web/.htaccess#L37 [Best Practices] removed unused link in business-logic Add missing space in code [Config] Complete security encoder in full default configuration [reference][configuration][security]Added key_length for pbkdf2 encoder Fixed typo Reworded a misleading Doctrine explanation
2 parents d1afa4d + 1ae4e80 commit 30c036b

File tree

6 files changed

+39
-16
lines changed

6 files changed

+39
-16
lines changed

best_practices/business-logic.rst

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -333,9 +333,6 @@ a command-line utility that can fix the coding standards of an entire codebase
333333
in a matter of seconds.
334334

335335
.. _`full definition`: http://en.wikipedia.org/wiki/Business_logic
336-
.. _`Toran Proxy`: https://toranproxy.com/
337-
.. _`Composer`: https://getcomposer.org/
338-
.. _`MVC architecture`: http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller
339336
.. _`Doctrine project`: http://www.doctrine-project.org/
340337
.. _`fixture class`: http://symfony.com/doc/master/bundles/DoctrineFixturesBundle/index.html#writing-simple-fixtures
341338
.. _`PSR-1`: http://www.php-fig.org/psr/psr-1/

book/doctrine.rst

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -544,13 +544,12 @@ Take a look at the previous example in more detail:
544544

545545
.. note::
546546

547-
In fact, since Doctrine is aware of all your managed entities, when you
548-
call the ``flush()`` method, it calculates an overall changeset and executes
549-
the most efficient query/queries possible. For example, if you persist a
550-
total of 100 ``Product`` objects and then subsequently call ``flush()``,
551-
Doctrine will create a *single* prepared statement and re-use it for each
552-
insert. This pattern is called *Unit of Work*, and it's used because it's
553-
fast and efficient.
547+
In fact, since Doctrine is aware of all your managed entities, when you call
548+
the ``flush()`` method, it calculates an overall changeset and executes
549+
the queries in the correct order. It utilizes cached prepared statement to
550+
slightly improve the performance. For example, if you persist a total of 100
551+
``Product`` objects and then subsequently call ``flush()``, Doctrine will
552+
execute 100 ``INSERT`` queries using a single prepared statement object.
554553

555554
When creating or updating objects, the workflow is always the same. In the
556555
next section, you'll see how Doctrine is smart enough to automatically issue

components/dependency_injection/tags.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ To begin with, change the ``TransportChain`` class::
211211
public function getTransport($alias)
212212
{
213213
if (array_key_exists($alias, $this->transports)) {
214-
return $this->transports[$alias];
214+
return $this->transports[$alias];
215215
}
216216
}
217217
}

components/event_dispatcher/introduction.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ Connecting Listeners
134134

135135
To take advantage of an existing event, you need to connect a listener to the
136136
dispatcher so that it can be notified when the event is dispatched. A call to
137-
the dispatcher ``addListener()`` method associates any valid PHP callable to
137+
the dispatcher's ``addListener()`` method associates any valid PHP callable to
138138
an event::
139139

140140
$listener = new AcmeListener();
@@ -158,7 +158,7 @@ The ``addListener()`` method takes up to three arguments:
158158
A `PHP callable`_ is a PHP variable that can be used by the
159159
``call_user_func()`` function and returns ``true`` when passed to the
160160
``is_callable()`` function. It can be a ``\Closure`` instance, an object
161-
implementing an __invoke method (which is what closures are in fact),
161+
implementing an ``__invoke`` method (which is what closures are in fact),
162162
a string representing a function, or an array representing an object
163163
method or a class method.
164164

@@ -591,7 +591,7 @@ Dispatcher Shortcuts
591591

592592
The :method:`EventDispatcher::dispatch <Symfony\\Component\\EventDispatcher\\EventDispatcher::dispatch>`
593593
method always returns an :class:`Symfony\\Component\\EventDispatcher\\Event`
594-
object. This allows for various shortcuts. For example if one does not need
594+
object. This allows for various shortcuts. For example, if one does not need
595595
a custom event object, one can simply rely on a plain
596596
:class:`Symfony\\Component\\EventDispatcher\\Event` object. You do not even need
597597
to pass this to the dispatcher as it will create one by default unless you

cookbook/configuration/web_server_configuration.rst

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,13 +206,27 @@ are:
206206
# try to serve file directly, fallback to app.php
207207
try_files $uri /app.php$is_args$args;
208208
}
209-
210-
location ~ ^/(app|app_dev|config)\.php(/|$) {
209+
# DEV
210+
# This rule should only be placed on your development environment
211+
# In production, don't include this and don't deploy app_dev.php or config.php
212+
location ~ ^/(app_dev|config)\.php(/|$) {
213+
fastcgi_pass unix:/var/run/php5-fpm.sock;
214+
fastcgi_split_path_info ^(.+\.php)(/.*)$;
215+
include fastcgi_params;
216+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
217+
fastcgi_param HTTPS off;
218+
}
219+
# PROD
220+
location ~ ^/app\.php(/|$) {
211221
fastcgi_pass unix:/var/run/php5-fpm.sock;
212222
fastcgi_split_path_info ^(.+\.php)(/.*)$;
213223
include fastcgi_params;
214224
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
215225
fastcgi_param HTTPS off;
226+
# Prevents URIs that include the front controller. This will 404:
227+
# http://domain.tld/app.php/some-path
228+
# Remove the internal directive to allow URIs like this
229+
internal;
216230
}
217231
218232
error_log /var/log/nginx/project_error.log;

reference/configuration/security.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,24 @@ Each part will be explained in the next section.
7070
hash_algorithm: sha512
7171
encode_as_base64: true
7272
iterations: 1000
73+
key_length: 40
7374
7475
# Example options/values for what a custom encoder might look like
7576
Acme\DemoBundle\Entity\User3:
7677
id: my.encoder.id
7778
79+
# BCrypt encoder
80+
# see the note about bcrypt below for details on specific dependencies
81+
Acme\DemoBundle\Entity\User4:
82+
algorithm: bcrypt
83+
cost: 13
84+
85+
# Plaintext encoder
86+
# it does not do any encoding
87+
Acme\DemoBundle\Entity\User5:
88+
algorithm: plaintext
89+
ignore_case: false
90+
7891
providers: # Required
7992
# Examples:
8093
my_in_memory_provider:

0 commit comments

Comments
 (0)