Commit Graph

15413 Commits

Author SHA1 Message Date
Bernhard Schussek
453882cd03 Revert "feature #11716 [OptionsResolver] Added a light-weight, low-level API for basic option resolving (webmozart)"
This reverts commit aa594450d2, reversing
changes made to cc63edbfa8.
2014-10-21 11:07:51 +02:00
Fabien Potencier
3fb5ad4d0c minor #12164 [TwigBridge] Replace default list style to icon (Macsch15)
This PR was merged into the 2.6-dev branch.

Discussion
----------

[TwigBridge] Replace default list style to icon

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Replaces default list style in **bootstrap_3_layout.html.twig** to icon.
Requires Glyphicons from Bootstrap 3.

Before:
![2014-10-07 11-55-50](https://cloud.githubusercontent.com/assets/1592053/4540807/d6f8eb46-4e0b-11e4-82bf-77b56fd1d17c.png)

After:
![2014-10-07 11-55-07](https://cloud.githubusercontent.com/assets/1592053/4540810/e02fe048-4e0b-11e4-9f3b-69902c0ae32b.png)

Commits
-------

9a0b2cc [TwigBridge] Replace default list style to icon
2014-10-20 15:54:32 +02:00
Fabien Potencier
a05379eab0 feature #12098 [Serializer] Handle circular references (dunglas)
This PR was merged into the 2.6-dev branch.

Discussion
----------

[Serializer] Handle circular references

| Q             | A
| ------------- | ---
| Bug fix?      | Yes: avoid infinite loops. Allows to improve #5347
| New feature?  | yes (circular reference handler)
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| License       | MIT
| Doc PR        | symfony/symfony-docs#4299

This PR adds handling of circular references in the `Serializer` component.
The number of allowed iterations is configurable (one by default).
The behavior when a circular reference is detected is configurable. By default an exception is thrown. Instead of throwing an exception, it's possible to register a custom handler (e.g.: a Doctrine Handler returning the object ID).

Usage:
```php
use Symfony\Component\Serializer\Normalizer\GetSetMethodNormalizer;
use Symfony\Component\Serializer\Serializer;

class MyObj
{
    private $id = 1312;

    public function getId()
    {
        return $this->getId();
    }

    public function getMe()
    {
        return $this;
    }
}

$normalizer = new GetSetMethodNormalizer();
$normalizer->setCircularReferenceLimit(3);
$normalizer->setCircularReferenceHandler(function ($obj) {
    return $obj->getId();
});

$serializer = new Serializer([$normalizer]);
$serializer->normalize(new MyObj());
```

Commits
-------

48491c4 [Serializer] Handle circular references
2014-10-20 11:20:49 +02:00
Fabien Potencier
269e27fb49 feature #12251 [Bridge][Doctrine][Form] Add entity manager instance support for em option (egeloen)
This PR was merged into the 2.6-dev branch.

Discussion
----------

[Bridge][Doctrine][Form] Add entity manager instance support for em option

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #10157
| License       | MIT
| Doc PR        | symfony/symfony-docs#4336

This PR allows to pass an explicit entity manager instance as em option.

Commits
-------

d84e3a8 [Bridge][Doctrine][Form] Add entity manager instance support for em option
2014-10-20 11:17:48 +02:00
Eric GELOEN
d84e3a8382 [Bridge][Doctrine][Form] Add entity manager instance support for em option 2014-10-19 19:05:36 +02:00
Christian Flothmann
bf174cf292 [FrameworkBundle] improve server commands feedback
* display a message when `server:start` is executed and the PCNTL
  extension is not loaded
* print instructions about how to terminate the `server:run` command
2014-10-18 21:00:49 +02:00
Nicolas Grekas
3c401af023 [VarDumper] enhance dumping refs 2014-10-17 09:38:59 +02:00
Fabien Potencier
8e42756c37 minor #12191 [Security] More accurate docblocks for AbstractVoter (johnkary)
This PR was squashed before being merged into the 2.6-dev branch (closes #12191).

Discussion
----------

[Security] More accurate docblocks for AbstractVoter

| Q             | A
| ------------- | ---
| Fixed tickets | none
| License       | MIT

Two fixes for docblocks in AbstractVoter:

1. Previously the example return value for a few methods used PHP's short array syntax (>= PHP 5.4). Symfony minimum PHP is 5.3 so the docblock examples should be compatible with that.

2. Previously getSupportedClasses() docblock had an example return value showing a FQCN using a leading slash. AbstractVoter looks for `get_class($object)` in the array of getSupportedClasses() returned values, and `get_class()` returns the FQCN without a leading slash.

Commits
-------

ed226ec [Security] More accurate docblocks for AbstractVoter
2014-10-10 18:59:55 +02:00
John Kary
ed226ec258 [Security] More accurate docblocks for AbstractVoter 2014-10-10 18:59:52 +02:00
Kévin Dunglas
48491c4441 [Serializer] Handle circular references 2014-10-09 19:55:06 +02:00
Tobias Schultze
41412f99f0 [Routing] unify fluent interface in RequestContext 2014-10-09 18:12:58 +02:00
Fabien Potencier
8203c66e3a Merge branch '2.5'
* 2.5:
  [Routing] add tests for RequestContext
  [Routing] fix inconsistencies in RequestContext
  don't raise warnings when exception is thrown
  [Framework][DX] Set the proper validator class according to the configured api version
2014-10-09 18:00:19 +02:00
Fabien Potencier
b4ed800529 Merge branch '2.3' into 2.5
* 2.3:
  [Routing] add tests for RequestContext
  [Routing] fix inconsistencies in RequestContext
  don't raise warnings when exception is thrown
2014-10-09 18:00:03 +02:00
Tobias Schultze
676c4a0253 [Routing] add tests for RequestContext 2014-10-09 17:28:58 +02:00
Tobias Schultze
f61607f5cb [Routing] fix inconsistencies in RequestContext 2014-10-09 17:27:10 +02:00
Christian Flothmann
38e9623ca4 don't raise warnings when exception is thrown
`array_map()` raises a warning when an exception is thrown inside the
callback (see https://bugs.php.net/bug.php?id=55416). To avoid these
warnings, `selectorToXPath()` is applied inside the loop.
2014-10-09 14:30:02 +02:00
Christian Flothmann
292088ffd5 add changelog entry for web server commands 2014-10-09 12:52:43 +02:00
Fabien Potencier
4430f75e89 bug #12180 Prevent an empty choice list being passed in debug:container (weaverryan)
This PR was squashed before being merged into the 2.6-dev branch (closes #12180).

Discussion
----------

Prevent an empty choice list being passed in debug:container

Hi guys!

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | --
| License       | MIT
| Doc PR        | n/a

Currently, there is a "bug" where if you pass an empty array to ChoiceList, then you get this following warning from `QuestionHelper::doAsk()`:

>
Warning: max(): Array must contain at least one element

That should probably be fixed too, but it would go on an earlier version, so I didn't want to mix fixes for different branches.

Thanks!

Commits
-------

ef23b63 Prevent an empty choice list being passed in debug:container
2014-10-09 01:30:22 +02:00
Ryan Weaver
ef23b631e0 Prevent an empty choice list being passed in debug:container 2014-10-09 01:30:11 +02:00
Fabien Potencier
ade0db7fac bug #12181 [HttpKernel] properly handle exceptions in translator listener (xabbuh)
This PR was merged into the 2.6-dev branch.

Discussion
----------

[HttpKernel] properly handle exceptions in translator listener

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

The `setLocale()` method can throw an `\InvalidArgumentException` when
an invalid locale has been passed. These exceptions must be handled by
the `TranslatorListener` which should then pass the request's default
locale instead.

Commits
-------

d3a0a55 properly handle exceptions in translator listener
2014-10-09 01:28:28 +02:00
Christian Flothmann
3b578a63b6 register TranslatorListener service
Since the `TranslatorListener` was not registered as a service, the
proper locale would never have been passed from the current request
to the translator.
2014-10-08 22:43:39 +02:00
Christian Flothmann
d3a0a55455 properly handle exceptions in translator listener
The `setLocale()` method can throw an `\InvalidArgumentException` when
an invalid locale has been passed. These exceptions must be handled by
the `TranslatorListener` which should then pass the request's default
locale instead.
2014-10-08 22:39:21 +02:00
Artur Eshenbrener
60ce31d284 [Routing] Moving include instruction to separate method 2014-10-07 16:17:15 +02:00
Fabien Potencier
69770bd191 minor #12145 [VarDumper] Sfdump JS ns and VarCloner replacing Ext+PhpCloner (nicolas-grekas)
This PR was merged into the 2.6-dev branch.

Discussion
----------

[VarDumper] Sfdump JS ns and VarCloner replacing Ext+PhpCloner

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #12140
| License       | MIT
| Doc PR        | -

As VarDumper is independant of the WDT, this patch creates a new JavaScript namespace used for HTML dumps.

Commits
-------

da96ad8 [VarDumper] Sfdump JS ns and VarCloner replacing Ext+PhpCloner
2014-10-07 16:10:40 +02:00
Fabien Potencier
0476ce883c minor #12146 [HttpFoundation] Fix PdoSessionHandler to work properly with streams (rybakit)
This PR was squashed before being merged into the 2.6-dev branch (closes #12146).

Discussion
----------

[HttpFoundation] Fix PdoSessionHandler to work properly with streams

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| License       | MIT

Ref: https://github.com/symfony/symfony/pull/10931#discussion_r18387931

Commits
-------

9531a2b [HttpFoundation] Fix PdoSessionHandler to work properly with streams
2014-10-07 16:06:26 +02:00
Eugene Leonovich
9531a2b3f1 [HttpFoundation] Fix PdoSessionHandler to work properly with streams 2014-10-07 16:06:18 +02:00
Peter Rehm
eb3dd0ff29 [Framework][DX] Set the proper validator class according to the configured api version 2014-10-07 14:35:24 +02:00
Maciej Schmidt
9a0b2cc818 [TwigBridge] Replace default list style to icon 2014-10-07 12:18:14 +02:00
Nicolas Grekas
56ae5442f7 [Framework+SecurityBundle] remove recently introduced *.class parameters 2014-10-06 15:17:46 +02:00
Nicolas Grekas
da96ad846d [VarDumper] Sfdump JS ns and VarCloner replacing Ext+PhpCloner 2014-10-06 14:52:17 +02:00
Christian Flothmann
e3332ad882 [TwigBridge] fix tests 2014-10-06 13:17:54 +02:00
Fabien Potencier
a7d52fda77 Merge branch '2.5'
* 2.5:
  [FrameworkBundle] minor fix
  [Console] add a dot
  [Form] remove unnecessary call
  clean handling of :: passed to find()

Conflicts:
	src/Symfony/Bundle/FrameworkBundle/Controller/ControllerNameParser.php
	src/Symfony/Component/Console/Tests/Fixtures/application_1.txt
	src/Symfony/Component/Console/Tests/Fixtures/application_2.txt
	src/Symfony/Component/Console/Tests/Fixtures/application_astext1.txt
	src/Symfony/Component/Console/Tests/Fixtures/application_astext2.txt
	src/Symfony/Component/Console/Tests/Fixtures/application_gethelp.txt
	src/Symfony/Component/Console/Tests/Fixtures/application_run1.txt
2014-10-05 15:59:22 +02:00
Fabien Potencier
643fdc8124 Merge branch '2.3' into 2.5
* 2.3:
  [FrameworkBundle] minor fix
  [Console] add a dot
  [Form] remove unnecessary call

Conflicts:
	src/Symfony/Component/Console/Tests/Fixtures/application_1.json
	src/Symfony/Component/Console/Tests/Fixtures/application_2.json
2014-10-05 15:57:04 +02:00
Fabien Potencier
089129be9f feature #11976 [Yaml] Ensure whole number floats have their data type is persisted. (Alex Pott)
This PR was squashed before being merged into the 2.6-dev branch (closes #11976).

Discussion
----------

[Yaml] Ensure whole number floats have their data type is persisted.

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | Yes
| Fixed tickets | N/A
| License       | MIT
| Doc PR        | no

See http://yaml.org/spec/1.1/#id858936 specifically the spec about specific data types.

Sample code that exposes the issue:
```php
$yaml = new \Symfony\Component\Yaml\Yaml();

$expected = array('float' => (float) 1);
$test = $yaml->parse($yaml->dump($expected));

if ($expected === $test) {
  print "match!\n";
}
else {
  var_dump($test);
}
```

This will output
```
array(1) {
  'float' =>
  int(1)
}
```

Commits
-------

6a507cc [Yaml] Ensure whole number floats have their data type is persisted.
2014-10-05 15:53:50 +02:00
Alex Pott
6a507ccaef [Yaml] Ensure whole number floats have their data type is persisted. 2014-10-05 15:53:47 +02:00
Fabien Potencier
87d5856055 minor #12125 [VarDumper] Dynamic HTML dumper (nicolas-grekas)
This PR was merged into the 2.6-dev branch.

Discussion
----------

[VarDumper] Dynamic HTML dumper

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #12109
| License       | MIT
| Doc PR        | -

This PR partially reverts #12109 because it didn't take into account that many dumps can share a single style tag.
More importantly, this PR enhance dump rendering with some cute JS navigation effects:
- references highlighting on hovering
- moving references toggling

Here is a screenshot (note the yellow background and the fact that `#2` appears after the first `@2`):
![capture du 2014-10-04 09 45 44](https://cloud.githubusercontent.com/assets/243674/4514936/4431c67e-4b9b-11e4-9809-8d06836be824.png)

Commits
-------

b799844 [VarDumper] Dynamic HTML dumper
2014-10-05 15:50:21 +02:00
Ala Eddine Khefifi
cd966c6826 [FrameworkBundle] minor fix
A small fix in the "parse" function of the "ControllerNameParser" Controller.
We should use "!==" instead of "!=" since it's better and faster in this case.

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | NA
| License       | MIT
| Doc PR        | NA
2014-10-05 15:47:08 +02:00
MightyBranch
fb0e685286 [Console] add a dot 2014-10-05 15:45:10 +02:00
Fabien Potencier
3c81b52f90 feature #10272 [TwigBridge] Added form_twitter_bootstrap_x.y.z_layout.html.twig (lyrixx)
This PR was merged into the 2.6-dev branch.

Discussion
----------

[TwigBridge] Added form_twitter_bootstrap_x.y.z_layout.html.twig

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | not yet

Doc:

``` yaml
# config.yml
twig:
    form:
        resources:
            - form_twitter_bootstrap_2.3.x_layout.html.twig
```

or

```jinja

{% form_theme form 'form_twitter_bootstrap_2.3.x_layout.html.twig' %}

{{ form(form) }}
```

Commits
-------

cfc04a6 [TwigBridge] Added form_twitter_bootstrap_layout.html.twig
2014-10-05 15:30:05 +02:00
Fabien Potencier
ffd81ad323 feature #12096 Add an action to show *error* pages in kernel.debug mode (mpdude)
This PR was squashed before being merged into the 2.6-dev branch (closes #12096).

Discussion
----------

Add an action to show *error* pages in kernel.debug mode

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #7446, #1486, #11327
| License       | MIT
| Doc PR        | symfony/symfony-docs#4293

See #7446 for the initial reasoning. In short, add to your `routing_development.yml` file the following

```yaml
_errors:
    resource: "@TwigBundle/Resources/config/routing/errors.xml"
    prefix:   /_error
```

Then you can use `http://localhost/app_dev.php/_error/xxx` to preview the HTML *error* page that the default `ExceptionController` (from `TwigBundle`) would pick for the XXX status code.

You can also use `http://localhost/app_dev.php/_error/xxx.{some_format}` to show error pages for other formats than HTML, most notably `txt`.

Note that the status code will be 500 for all exceptions [that do not implement `HttpExceptionInterface`](https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Debug/Exception/FlattenException.php#L47).

##### Want to test with a custom exception?

~~Folks might want to display (part of) the exception even on error pages and thus need to work with generic (own) exceptions.~~

~~They could write an arbitrary controller and throw their exception there. By default, the `ExceptionController` would be used to handle this, only that it would not show *error* pages in `kernel.debug` mode.~~

~~Thus, a simple public setter to change the `debug` flag after construction could help. Do we want to add that as well?~~

If you want to test error pages with your own exceptions,
* create a subclass of `ExceptionController`
* set the protected `debug` flag to false
* register it as twig.exception_controller in the config
* throw your custom exception from any controller.

That should give you the error page also in `kernel.debug` mode.

##### To-Do
- [x] Update docs
- [x] Add route in symfony/symfony-default

Commits
-------

66ed177 Add an action to show *error* pages in kernel.debug mode
2014-10-05 15:27:45 +02:00
Matthias Pigulla
66ed17778e Add an action to show *error* pages in kernel.debug mode 2014-10-05 15:27:43 +02:00
Nicolas Grekas
b799844c68 [VarDumper] Dynamic HTML dumper 2014-10-05 10:46:57 +02:00
Tobias Schultze
4e45a39cc0 [Form] remove unnecessary call 2014-10-05 05:13:10 +02:00
Christian Flothmann
baab4edf35 clean handling of :: passed to find()
Commands cannot have a double colon in their name (for example, a
command can't be named `foo::bar`). However, one might try to
retrieve a `foo::bar` command from the application like this:

```php
$command = $application->find('foo::bar');
```

The `findAlternatives()` method of the `Application` class fails to
handle these strings when there are commands registered with a name
consisting of at least three parts (e.g. a command is named
`foo:bar:baz`). In this case, an empty string is passed to `strpos()`
causing PHP to raise a warning.
2014-10-04 12:23:49 +02:00
Fabien Potencier
08ff3fd5bf minor #12126 [Validator] Fix Binary Format when maxSize is smaller than uploadLimit (Jérémy Derussé)
This PR was merged into the 2.6-dev branch.

Discussion
----------

[Validator] Fix Binary Format when maxSize is smaller than uploadLimit

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | NA
| License       | MIT
| Doc PR        | NA

Add a small fix to #12103.
If constraint `maxSize` is defined with base10 (K or M) and is smaller than ini `upload_max_filesize` (defined with base2 (Ki, Mi, Gi, ...) then the error message will not be nicely displayed.

Commits
-------

ef30dea Fix Binary Format when maxSize is smaller than uploadLimit
2014-10-04 11:29:35 +02:00
Fabien Potencier
59bfe830e4 minor #12127 [WIP] minor [Serializer] Fix CS (dunglas)
This PR was merged into the 2.6-dev branch.

Discussion
----------

[WIP] minor [Serializer] Fix CS

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| License       | MIT

* Reverts CS breaks introduced by #12102 found by @stof and @xabbuh.
* Fix CS of `PropertyNormalizer` (missed in last commit)

Commits
-------

dffa3e4 [Serializer] Fix CS
2014-10-04 11:28:32 +02:00
Fabien Potencier
e0d7f127d7 feature #12123 [FrameworkBundle] make assets-install --relative equivalent to --symlink --relative (fabpot)
This PR was merged into the 2.6-dev branch.

Discussion
----------

[FrameworkBundle] make assets-install --relative equivalent to --symlink --relative

| Q             | A
| ------------- | ---
| Bug fix?      | kinda
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a

The `--relative` option of `assets:install` only makes sense when asking for symlinks. Before this change, you were forced to pass the two options: `--symlink --relative`. This PR lets you just use `--relative` and the `--symlink` option will be set for you.

This PR also fallbacks to absolute symlinks when relative ones do not work.

Commits
-------

87d4039 [FrameworkBundle] make assets-install --relative equivalent to --symlink --relative
2014-10-04 11:27:41 +02:00
Kévin Dunglas
dffa3e408d [Serializer] Fix CS 2014-10-04 10:54:52 +02:00
Fabien Potencier
87d4039046 [FrameworkBundle] make assets-install --relative equivalent to --symlink --relative 2014-10-04 10:17:51 +02:00
Jérémy Derussé
ef30dea814 Fix Binary Format when maxSize is smaller than uploadLimit 2014-10-04 09:54:45 +02:00