Commit Graph

18617 Commits

Author SHA1 Message Date
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
Fabien Potencier
530813519e minor #12150 [Framework+SecurityBundle] remove recently introduced *.class parameters (nicolas-grekas)
This PR was merged into the 2.6-dev branch.

Discussion
----------

[Framework+SecurityBundle] remove recently introduced *.class parameters

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

This is just a cleanup that removes `*.class` parameters introduced in the master branch (and not in the 2.5 one).
#12145 also removes the remaining params for the Debug/TwigBundle

Commits
-------

56ae544 [Framework+SecurityBundle] remove recently introduced *.class parameters
2014-10-07 16:01:27 +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
Fabien Potencier
966c586ff1 minor #12142 [TwigBridge] fix DumpExtension tests (xabbuh)
This PR was squashed before being merged into the 2.6-dev branch (closes #12142).

Discussion
----------

[TwigBridge] fix `DumpExtension` tests

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

Make test compatible with the changes from #12125.

Commits
-------

e3332ad [TwigBridge] fix  tests
2014-10-06 13:17:57 +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
Fabien Potencier
39246def18 bug #12128 [Console] clean handling of :: passed to find() (xabbuh)
This PR was merged into the 2.5 branch.

Discussion
----------

[Console] clean handling of :: passed to find()

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

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.

In a "real" Symfony application, calling `php ./app/console cache::clear` now results in the following error message:

```
  [InvalidArgumentException]
  There are no commands defined in the "cache:" namespace.
  Did you mean this?
      cache
```

Commits
-------

baab4ed clean handling of :: passed to find()
2014-10-05 15:48:36 +02:00
Fabien Potencier
6df49bb9e1 minor #12130 [FrameworkBundle] minor fix (NAYZO)
This PR was submitted for the master branch but it was merged into the 2.3 branch instead (closes #12130).

Discussion
----------

[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?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | NA
| License       | MIT
| Doc PR        | NA

Commits
-------

cd966c6 [FrameworkBundle] minor fix
2014-10-05 15:47:18 +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
Fabien Potencier
db44606580 minor #12135 [Console] add a dot (MightyBranch)
This PR was submitted for the 2.5 branch but it was merged into the 2.3 branch instead (closes #12135).

Discussion
----------

[Console] add a dot

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

Added a "." at the end of an InputOption description, as the rest of the InputOption descriptions have it.

Commits
-------

fb0e685 [Console] add a dot
2014-10-05 15:45:15 +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
Fabien Potencier
34a638bc64 minor #12134 [Form] remove unnecessary call (Tobion)
This PR was merged into the 2.3 branch.

Discussion
----------

[Form] remove unnecessary call

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

Commits
-------

4e45a39 [Form] remove unnecessary call
2014-10-05 09:29:26 +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
Fabien Potencier
218eb2be0c fixed composer.json 2014-10-04 08:12:37 +02:00
Fabien Potencier
ec2ca9b3d7 minor #12117 tests for the TranslatorListener (xabbuh)
This PR was merged into the 2.6-dev branch.

Discussion
----------

tests for the TranslatorListener

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

Commits
-------

26b619b tests for the TranslatorListener
2014-10-04 08:12:13 +02:00
Fabien Potencier
b976b93f8c feature #12103 [Validator] Display a nice upload limit message (Jérémy Derussé)
This PR was merged into the 2.6-dev branch.

Discussion
----------

[Validator] Display a nice upload limit message

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

Actualy when a user upload a file who exceed the upload limit, the error messag looks like `The file is too large. Allowed maximum size is 2097152 bytes.` which is not very readable.
This PR use the same method who generate the `maxSize` error message by gessing the smallest possible number.
The error message became `The file is too large. Allowed maximum size is 2 MiB.`

Commits
-------

b6e29e9 Display a nice upload limit message
2014-10-04 08:11:05 +02:00
Fabien Potencier
8afa3c2439 minor #12116 [VarDumper] encode non-ASCII UTF-8 chars as HTML numeric entities (nicolas-grekas)
This PR was merged into the 2.6-dev branch.

Discussion
----------

[VarDumper] encode non-ASCII UTF-8 chars as HTML numeric entities

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

Commits
-------

e383a38 [VarDumper] encode non-ASCII UTF-8 chars as HTML numeric entities
2014-10-04 08:09:30 +02:00
Fabien Potencier
17fcdb8cb8 Merge branch '2.5'
* 2.5:
  fix RegisterListenersPass test
2014-10-04 08:08:58 +02:00
Nicolas Grekas
e383a38763 [VarDumper] encode non-ASCII UTF-8 chars as HTML numeric entities 2014-10-03 18:04:15 +02:00
Christian Flothmann
26b619b337 tests for the TranslatorListener 2014-10-03 17:48:46 +02:00
Fabien Potencier
9b2195c17b minor #12113 [WebProfileBundle], [DebugBundle] Fixed big data in toolbar (hason)
This PR was merged into the 2.6-dev branch.

Discussion
----------

[WebProfileBundle], [DebugBundle] Fixed big data in toolbar

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

| Before | After
| --------- | -------
| ![prev-01](https://cloud.githubusercontent.com/assets/288535/4505427/72bd9d08-4af4-11e4-9aed-be4f868c3dfd.png) | ![post-01](https://cloud.githubusercontent.com/assets/288535/4505432/82583746-4af4-11e4-8052-658d4853cfb4.png)
| ![prev-02](https://cloud.githubusercontent.com/assets/288535/4505426/72bd9bb4-4af4-11e4-88ad-1949b6201684.png) | ![post-02](https://cloud.githubusercontent.com/assets/288535/4505431/824fb85a-4af4-11e4-88f5-5e01f907c580.png)

Commits
-------

febe836 [DebugBundle] Removed unnecessary div in toolbar
513d2d3 [WebProfilerBundle] Showed all ajax calls in toolbar
2014-10-03 15:11:31 +02:00
Fabien Potencier
063826d17f minor #12109 [VarDumper] Improved dump in html (hason)
This PR was merged into the 2.6-dev branch.

Discussion
----------

[VarDumper] Improved dump in html

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | http://www.w3.org/TR/html5/dom.html#the-id-attribute
| License       | MIT
| Doc PR        | -

Commits
-------

f214eda [VarDumper] Added unique id for every single dump in html
2014-10-03 14:41:34 +02:00
Martin Hasoň
f214edac76 [VarDumper] Added unique id for every single dump in html 2014-10-03 14:13:48 +02:00
Martin Hasoň
febe8367e0 [DebugBundle] Removed unnecessary div in toolbar 2014-10-03 14:01:35 +02:00
Martin Hasoň
513d2d3d6e [WebProfilerBundle] Showed all ajax calls in toolbar 2014-10-03 14:01:18 +02:00
Fabien Potencier
3da6fc22c6 feature #12081 [FrameworkBundle] enable ErrorHandler in prod (nicolas-grekas)
This PR was merged into the 2.6-dev branch.

Discussion
----------

[FrameworkBundle] enable ErrorHandler in prod

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

-  a new debug.error_handler service is the registered PHP error handler, with ErrorHandler::register() as factory
- ErrorHandler::register() is patched so that it checks if the currently registered error handler is an instance of ErrorHandler - in which case it returns this instance and don't create a new one.
- DebugHandlersListener now listen to ConsoleEvents and re-injects fatal errors within the $app->renderException code path
- DebugHandlersListener also has a new $scream parameter to control is silenced errors are logged or not

Commits
-------

fac3cc4 [FrameworkBundle] register ErrorHandler at boot time
4acf5d3 [Debug] make screaming configurable
4d0ab7d [FrameworkBundle] enable ErrorHandler in prod
2014-10-03 11:43:16 +02:00
Fabien Potencier
b5c4d54f11 minor #12102 minor [Serializer] Fix CS. Uniformize PHPDoc. (dunglas)
This PR was merged into the 2.6-dev branch.

Discussion
----------

minor [Serializer] Fix CS. Uniformize PHPDoc.

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

Commits
-------

5be84c4 [Serializer] Fix CS. Uniformize PHPDoc.
2014-10-03 07:39:07 +02:00
Fabien Potencier
8a5f8248c9 minor #12065 [DependencyInjection] Tweaked factories (unkind)
This PR was merged into the 2.6-dev branch.

Discussion
----------

[DependencyInjection] Tweaked factories

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

There are some issues with new service factories:
 * `ContainerBuilder` cannot instantiate service from factory (i.e. currently it works for dumped code only)
 * Dumped code sometimes is invalid (anonymous services as factories, factories without arguments)

Commits
-------

ee82392 [DependencyInjection] Tweaked factories
2014-10-03 07:32:40 +02:00
Fabien Potencier
8d7cabd39c feature #10931 [HttpFoundation] enhance PdoSessionHandler (Tobion)
This PR was merged into the 2.6-dev branch.

Discussion
----------

[HttpFoundation] enhance PdoSessionHandler

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | yes
| BC breaks?    | yes
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #5483, #2067, #2382, #9029
| License       | MIT

0. [x] Continuation of locking implementation (#10908): Implement different locking strategies
  - `PdoSessionHandler::LOCK_TRANSACTIONAL` (default): Issues a real row lock but requires a transaction
  - `PdoSessionHandler::LOCK_ADVISORY`: app-level lock, safe as long as only the PdoSessionHandler accesses sessions, advantage is it does not require a transaction (not implemented for oracle or sqlsrv yet)
  - `PdoSessionHandler::LOCK_NONE`: basically what is was before, prone to race conditions, means the last session write wins

1. [x] Save session data as binary: Encoding session data was definitely the wrong solution. Session data is binary text (esp. when using other session.serialize_handler) that must stay as-is and thus must also be safed in a binary column. Base64 encoding session data just decreses performance and increases storage costs and is semantically wrong because it does not have a character encoding.
That saving null bytes in Posgres won't work on a character column is also documented

    > First, binary strings specifically allow storing octets of value zero and other "non-printable" octets (usually, octets outside the range 32 to 126). Character strings disallow zero octets, and also disallow any other octet values and sequences of octet values that are invalid according to the database's selected character set encoding.
http://www.postgresql.org/docs/9.1/static/datatype-binary.html#DATATYPE-BINARY-TABLE

2. [x] Implement lazy connections that are only opened when session is used by either passing a dsn string explicitly or falling back to session.save_path ini setting. Fixes #9029

3. [x] add a create table method that creates the correct table depending on database vendor. This makes the class self-documenting and standalone useable.

5. [x] add lifetime column to session table which allows to have different lifetimes for each session

6. [x] add isSessionExpired() method to be able to distinguish between a new session and one that expired due to inactivity, e.g. to display flash message to user

7. [x] added upgrade and changelog notes

Commits
-------

1bc6680 [HttpFoundation] implement different locking strategies for sessions
6f5748e adjust sqlite table definition
5978fcf added upgrade and changelog notes for PdoSessionHandler
182a5d3 [HttpFoundation] add create table method to pdo session handler
e79229d [HttpFoundation] allow different lifetime per session
af1bb1f add test for null byte in session data
251238d [HttpFoundation] implement lazy connect for pdo session handler
7dad54c [HttpFoundation] remove base64 encoding of session data
2014-10-03 07:26:43 +02:00
Jérémy Derussé
b6e29e9f34 Display a nice upload limit message 2014-10-02 22:26:18 +02:00
Kévin Dunglas
5be84c4bf0 [Serializer] Fix CS. Uniformize PHPDoc. 2014-10-02 20:41:27 +02:00
Tobias Schultze
1bc6680928 [HttpFoundation] implement different locking strategies for sessions 2014-10-02 20:16:41 +02:00