Commit Graph

10362 Commits

Author SHA1 Message Date
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
Eugene Leonovich
9531a2b3f1 [HttpFoundation] Fix PdoSessionHandler to work properly with streams 2014-10-07 16:06:18 +02:00
Nicolas Grekas
da96ad846d [VarDumper] Sfdump JS ns and VarCloner replacing Ext+PhpCloner 2014-10-06 14:52:17 +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
MightyBranch
fb0e685286 [Console] add a dot 2014-10-05 15:45:10 +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
Kévin Dunglas
dffa3e408d [Serializer] Fix CS 2014-10-04 10:54:52 +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
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
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
Nicolas Grekas
4acf5d3d0b [Debug] make screaming configurable 2014-10-02 11:12:20 +02:00
Nicolas Grekas
4d0ab7ddc1 [FrameworkBundle] enable ErrorHandler in prod 2014-10-02 11:12:20 +02:00
Fabien Potencier
0314d7549e feature #12061 [Debug] expose object_handle (nicolas-grekas)
This PR was merged into the 2.6-dev branch.

Discussion
----------

[Debug] expose object_handle

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

This is a small enhancement to the symfony debug C extension that allows fetching an object's handle.
This is the `#number` as displayed by var_dump():
`class stdClass**#1** (0) {}`

This is required for VarDumper to be able to expose objects' handles and thus have more precise dumps.
It will allow inspecting "same" relationships between two *different* dumps.

Commits
-------

5f6b676 [Debug] expose object_handle
2014-10-02 10:36:11 +02:00
Nikita Konstantinov
ee82392074 [DependencyInjection] Tweaked factories 2014-10-02 01:48:53 +04:00
Christian Flothmann
9d2120b562 fix RegisterListenersPass test
With #12088 being merged, the test needs to be adapted to reflect the
2.5 specific changes.
2014-10-01 17:43:05 +02:00
Fabien Potencier
6acf3e74ae Merge branch '2.5'
* 2.5:
  [Doc] Use Markdown syntax highlighting
  [Finder] tweaked docs
  [Finder] Add info about possibilities offered by SplFileInfo
  fixed CS
  [Security][Http][Authentication] Make a test pass on HHVM
  fix components tests
  [Intl] FIxed failing test
  [Intl] Generated the data for ICU version 54-rc
  [EventDispatcher] fix doc bloc on EventDispatcherInterface
  [Validator] Update validators.zh_CN.xlf, fix translation error
  bumped Symfony version to 2.5.6
  updated VERSION for 2.5.5
  updated CHANGELOG for 2.5.5
  bumped Symfony version to 2.3.21
  updated VERSION for 2.3.20
  update CONTRIBUTORS for 2.3.20
  updated CHANGELOG for 2.3.20
  [Intl] Integrated ICU data into Intl component

Conflicts:
	src/Symfony/Component/Debug/README.md
	src/Symfony/Component/DependencyInjection/README.md
	src/Symfony/Component/HttpKernel/Kernel.php
	src/Symfony/Component/OptionsResolver/README.md
2014-10-01 07:53:11 +02:00
Fabien Potencier
cfd1ecfe84 Merge branch '2.3' into 2.5
* 2.3:
  [Doc] Use Markdown syntax highlighting
  [Finder] tweaked docs
  [Finder] Add info about possibilities offered by SplFileInfo
  fix components tests
  [Intl] FIxed failing test
  [Intl] Generated the data for ICU version 54-rc
  [EventDispatcher] fix doc bloc on EventDispatcherInterface
  [Validator] Update validators.zh_CN.xlf, fix translation error
  bumped Symfony version to 2.3.21
  updated VERSION for 2.3.20
  update CONTRIBUTORS for 2.3.20
  updated CHANGELOG for 2.3.20
  [Intl] Integrated ICU data into Intl component

Conflicts:
	src/Symfony/Component/HttpKernel/Kernel.php
	src/Symfony/Component/Intl/ResourceBundle/LocaleBundle.php
2014-10-01 07:50:18 +02:00
Fabien Potencier
0e7694e5e9 Merge branch 'pull/12053' into 2.3
* pull/12053:
  [Doc] Use Markdown syntax highlighting

Conflicts:
	src/Symfony/Component/Finder/README.md
2014-10-01 07:39:06 +02:00
Laurent Ghirardotti
638ce847b3 [Doc] Use Markdown syntax highlighting 2014-10-01 07:38:33 +02:00
Fabien Potencier
03f3dec065 [Finder] tweaked docs 2014-10-01 07:36:12 +02:00
Yannick Warnier
b2219cf150 [Finder] Add info about possibilities offered by SplFileInfo 2014-10-01 07:33:40 +02:00
Fabien Potencier
d002f1744a minor #12088 fix components tests (xabbuh)
This PR was merged into the 2.3 branch.

Discussion
----------

fix components tests

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

Since #12006, the `ContainerBuilder` contains the `addExpressionLanguageProvider()` method which references a class from the ExpressionLanguage component. By default, the PHPUnit mock API tries to mock all methods of the class being doubled. Since the ExpressionLanguage component is not required to run the tests, creating the mock objects fails when the mock API fails to mock the `addExpressionLanguageProvider()` method.

Commits
-------

2f2a732 fix components tests
2014-10-01 07:29:49 +02:00
Fabien Potencier
e6bcb1cff4 fixed CS 2014-10-01 07:28:47 +02:00
Alex Bakhturin
7ff903ed39 [Security][Http][Authentication] Make a test pass on HHVM 2014-10-01 07:27:37 +02:00
Christian Flothmann
2f2a732807 fix components tests
Since #12006, the `ContainerBuilder` contains the
`addExpressionLanguageProvider()` method which references a class from
the ExpressionLanguage component. By default, the PHPUnit mock API
tries to mock all methods of the class being doubled. Since the
ExpressionLanguage component is not required to run the tests,
creating the mock objects fails when the mock API fails to mock
the `addExpressionLanguageProvider()` method.
2014-10-01 00:07:12 +02:00
Bernhard Schussek
b45ebef229 [Intl] FIxed failing test 2014-09-30 23:25:54 +02:00