Skip to content

Commit 3912063

Browse files
committed
Merge branch '2.8' into 3.4
* 2.8: Fix mismatched list items preUpdate Event Listener On Uploaded Imagery [PHPUnitBridge] Explain how to show stack traces Fix docs on trusted hosts opcode optimizations
2 parents 6def221 + 0ca3fdc commit 3912063

File tree

7 files changed

+40
-15
lines changed

7 files changed

+40
-15
lines changed

components/phpunit_bridge.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,24 @@ times (order matters)::
248248
@trigger_error('The second argument of the "Bar" method is deprecated.', E_USER_DEPRECATED);
249249
}
250250

251+
Display the Full Stack Trace
252+
----------------------------
253+
254+
By default, the PHPUnit Bridge displays only deprecation messages.
255+
To show the full stack trace related to a deprecation, set the value of ``SYMFONY_DEPRECATIONS_HELPER``
256+
to a regular expression matching the deprecation message.
257+
258+
For example, if the following deprecation notice is thrown::
259+
260+
1x: Doctrine\Common\ClassLoader is deprecated.
261+
1x in EntityTypeTest::setUp from Symfony\Bridge\Doctrine\Tests\Form\Type
262+
263+
Running the following command will display the full stack trace:
264+
265+
.. code-block:: terminal
266+
267+
$ SYMFONY_DEPRECATIONS_HELPER='/Doctrine\\Common\\ClassLoader is deprecated\./' ./vendor/bin/simple-phpunit
268+
251269
Time-sensitive Tests
252270
--------------------
253271

controller/upload_file.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,7 @@ automatically upload the file when persisting the entity::
311311
namespace AppBundle\EventListener;
312312

313313
use Symfony\Component\HttpFoundation\File\UploadedFile;
314+
use Symfony\Component\HttpFoundation\File\File;
314315
use Doctrine\ORM\Event\LifecycleEventArgs;
315316
use Doctrine\ORM\Event\PreUpdateEventArgs;
316317
use AppBundle\Entity\Product;
@@ -352,6 +353,10 @@ automatically upload the file when persisting the entity::
352353
if ($file instanceof UploadedFile) {
353354
$fileName = $this->uploader->upload($file);
354355
$entity->setBrochure($fileName);
356+
} elseif ($file instanceof File) {
357+
// prevents the full file path being saved on updates
358+
// as the path is set on the postLoad listener
359+
$entity->setBrochure($file->getFilename());
355360
}
356361
}
357362
}

reference/configuration/framework.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -390,16 +390,16 @@ method might be vulnerable to some of these attacks because it depends on
390390
the configuration of your web server. One simple solution to avoid these
391391
attacks is to whitelist the hosts that your Symfony application can respond
392392
to. That's the purpose of this ``trusted_hosts`` option. If the incoming
393-
request's hostname doesn't match one in this list, the application won't
394-
respond and the user will receive a 400 response.
393+
request's hostname doesn't match one of the regular expressions in this list,
394+
the application won't respond and the user will receive a 400 response.
395395

396396
.. configuration-block::
397397

398398
.. code-block:: yaml
399399
400400
# app/config/config.yml
401401
framework:
402-
trusted_hosts: ['example.com', 'example.org']
402+
trusted_hosts: ['^example\.com$', '^example\.org$']
403403
404404
.. code-block:: xml
405405
@@ -413,8 +413,8 @@ respond and the user will receive a 400 response.
413413
http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
414414
415415
<framework:config>
416-
<framework:trusted-host>example.com</framework:trusted-host>
417-
<framework:trusted-host>example.org</framework:trusted-host>
416+
<framework:trusted-host>^example\.com$</framework:trusted-host>
417+
<framework:trusted-host>^example\.org$</framework:trusted-host>
418418
<!-- ... -->
419419
</framework:config>
420420
</container>
@@ -423,17 +423,17 @@ respond and the user will receive a 400 response.
423423
424424
// app/config/config.php
425425
$container->loadFromExtension('framework', array(
426-
'trusted_hosts' => array('example.com', 'example.org'),
426+
'trusted_hosts' => array('^example\.com$', '^example\.org$'),
427427
));
428428
429-
Hosts can also be configured using regular expressions (e.g. ``^(.+\.)?example.com$``),
430-
which make it easier to respond to any subdomain.
429+
Hosts can also be configured to respond to any subdomain, via
430+
``^(.+\.)?example\.com$`` for instance.
431431

432432
In addition, you can also set the trusted hosts in the front controller
433433
using the ``Request::setTrustedHosts()`` method::
434434

435435
// web/app.php
436-
Request::setTrustedHosts(array('^(.+\.)?example.com$', '^(.+\.)?example.org$'));
436+
Request::setTrustedHosts(array('^(.+\.)?example\.com$', '^(.+\.)?example\.org$'));
437437

438438
The default value for this option is an empty array, meaning that the application
439439
can respond to any given host.

reference/forms/twig_reference.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ This test will check if the current ``form`` does not have a parent form view.
209209
.. code-block:: twig
210210
211211
{# DON'T DO THIS: this simple check can't differentiate between a form having
212-
a parent form view and a form defining a normal form field called 'parent' #}
212+
a parent form view and a form defining a nested form field called 'parent' #}
213213
214214
{% if form.parent is null %}
215215
{{ form_errors(form) }}

reference/twig_reference.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -734,6 +734,8 @@ rootform
734734
.. code-block:: twig
735735
736736
{% if form is rootform %}
737+
{# ... #}
738+
{% endif %}
737739
738740
``form``
739741
**type**: ``FormView``

security/guard_authentication.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -568,10 +568,10 @@ The problem occurs when your browser-based authenticator tries to authenticate
568568
the user on *every* request - like in the IP address-based example above. There
569569
are two possible fixes:
570570

571-
1) If you do *not* need authentication to be stored in the session, set ``stateless: true``
572-
under your firewall.
573-
574-
2) Update your authenticator to avoid authentication if the user is already authenticated:
571+
1. If you do *not* need authentication to be stored in the session, set
572+
``stateless: true`` under your firewall.
573+
2. Update your authenticator to avoid authentication if the user is already
574+
authenticated:
575575

576576
.. code-block:: diff
577577

validation/custom_constraint.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ includes some simple default logic::
4545
// in the base Symfony\Component\Validator\Constraint class
4646
public function validatedBy()
4747
{
48-
return get_class($this).'Validator';
48+
return \get_class($this).'Validator';
4949
}
5050

5151
In other words, if you create a custom ``Constraint`` (e.g. ``MyConstraint``),

0 commit comments

Comments
 (0)