Commit Graph

18798 Commits

Author SHA1 Message Date
Fabien Potencier
408c6aa501 minor #12086 [Security][Http][Authentication] Make a test pass on HHVM (AlphaStream)
This PR was submitted for the master branch but it was merged into the 2.5 branch instead (closes #12086).

Discussion
----------

[Security][Http][Authentication] Make a test pass on HHVM

The test mocks AuthenticationException mocking all its (and its ancestors') methods. In HHVM's implementation of \Exception, a static method is called upon instantiation. Mock object generator, however, mocks static methods with 'throw' statements. All of these cause the SimpleAuthenticationHandlerTest to fail on HHVM when attempting to instantiate the mock.

The solution is to disable method mocking for AuthenticationException. An instance of this class is merely passed around between the authentication handler and the failure handler, and no methods are invoked on it. Hence, disabling method mocking should not weaken the unit test.

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

Commits
-------

7ff903e [Security][Http][Authentication] Make a test pass on HHVM
2014-10-01 07:27:37 +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
Bernhard Schussek
40eaa80ef6 bug #11998 [Intl] Integrated ICU data into Intl component #2 (webmozart)
This PR was submitted for the master branch but it was merged into the 2.3 branch instead (closes #11998).

Discussion
----------

[Intl] Integrated ICU data into Intl component #2

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

Follow-up PR to #11920. This PR contains generated data files only.

Commits
-------

65a8b9f [Intl] Generated the data for ICU version 54-rc
2014-09-30 23:21:32 +02:00
Bernhard Schussek
65a8b9fc93 [Intl] Generated the data for ICU version 54-rc 2014-09-30 23:21:31 +02:00
Bernhard Schussek
1ce0f875be bug #11920 [Intl] Integrated ICU data into Intl component #1 (webmozart)
This PR was merged into the 2.3 branch.

Discussion
----------

[Intl] Integrated ICU data into Intl component #1

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

This PR is an alternative implementation to #11884. It depends on ~~#11906~~ and ~~#11907~~ being merged first (~~these are included in the diff until after a merge+rebase~~ merged+rebased now).

With this PR, the ICU component becomes obsolete. The ICU data is bundled with Intl in two different formats: JSON and the binary ICU resource bundle format (version 2) readable by PHP's `\ResourceBundle` class. For a performance comparison between the two, see my [benchmark](/webmozart/json-res-benchmark).

~~The data is contained in two zip files: json.zip (2.6MB) and rb-v2.zip (3.8MB). The handler~~

```php
\Symfony\Component\Intl\Composer\ScriptHandler::decompressData()
```

~~needs to be added as Composer hook and decompresses the data after install/update.~~

The data is included as text/binary now. Git takes care of the compression.

Before this PR can be merged, I would like to find out what the performance difference between the two formats is in real applications. For that, I need benchmarks from some real-life applications which use ICU data - e.g. in forms (language drop-downs, country selectors etc.) - for both the JSON and the binary data. You can force either format to be used by hard-coding the return value of `Intl::detectDataFormat()` to `Intl::JSON` and `Intl::RB_V2` respectively. I'll also try to create some more realistic benchmarks.

If JSON is not significantly slower/takes up significantly more memory than the binary format, we can drop the binary format altogether.

Commits
-------

be819c1 [Intl] Integrated ICU data into Intl component
2014-09-30 23:20:37 +02:00
Bernhard Schussek
832c78f47d feature #12050 [Form] Added "label_format" option (webmozart)
This PR was merged into the 2.6-dev branch.

Discussion
----------

[Form] Added "label_format" option

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

This PR replaces #11456. It adds a "label_format" option which allows to configure a format for generating labels. Two placeholders are available: `%name%` and `%id%`.

**Feedback wanted**: Should we change the placeholders to `{{ name }}` and `{{ id }}`?

The option is inherited from the parent form if not set explicitly on a field:

```php
$form = $this->createForm('myform', $data, array('label_format' => 'form.label.%id%'));
```

Follow-up PR: Make the default label format and translation domain configurable in config.yml.

Commits
-------

aad442d [Form] Added "label_format" option
2014-09-30 23:16:13 +02:00
Bernhard Schussek
95d68a1396 feature #12021 [Validator] Added error codes to all constraints with multiple error causes (webmozart)
This PR was merged into the 2.6-dev branch.

Discussion
----------

[Validator] Added error codes to all constraints with multiple error causes

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

This PR depends on #12015 and #12016 being merged first. However, a few changes in 52cb7df first must be backported to #12016.

This PR introduces error codes for all constraints with multiple error paths. This lets you determine what exactly the reason was that a constraint failed:

```php
$validator = Validation::createValidator();

$violations = $validator->validate('0-4X19-92619812', new Isbn());

foreach ($violations as $violation) {
    var_dump($violation->getCode());
    // => int(3)
    var_dump(Isbn::getErrorName($violation->getCode()));
    // => string(24) "ERROR_INVALID_CHARACTERS"
    var_dump($violation->getConstraint()->getErrorName($violation->getCode()));
    // => string(24) "ERROR_INVALID_CHARACTERS"
}
```

The `getErrorName()` method is especially helpful for REST APIs, where you can return both an error code and a description of that error now.

**Todos**

- [x] Backport a few structural changes to #12016
- [x] Update constraints outside of the Validator component
- [x] Rebase on master (after merging #12015 and #12016)

Commits
-------

3b50bf2 [Validator] Added error codes to all constraints with multiple error causes
2014-09-30 23:14:38 +02:00
Bernhard Schussek
3b50bf23a1 [Validator] Added error codes to all constraints with multiple error causes 2014-09-30 23:13:20 +02:00
Bernhard Schussek
2f3bb66e43 feature #12054 [Form] The trace of form errors is now displayed in the profiler (webmozart)
This PR was merged into the 2.6-dev branch.

Discussion
----------

[Form] The trace of form errors is now displayed in the profiler

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

This is a follow-up PR for #12052. With this change, the full trace of form errors is now displayed in the web debugger:

![error](https://cloud.githubusercontent.com/assets/176399/4419637/85facd14-456d-11e4-8c70-0e8802a586ec.png)

If a violation was caused by a TransformationFailedException, the exception is now accessible through the `getCause()` method of the violation. Additionally, you can access `Form::getTransformationFailure()` to retrieve the exception.

Commits
-------

8dbe258 [Form] The trace of form errors is now displayed in the profiler
2014-09-30 23:10:18 +02:00
Bernhard Schussek
8dbe25882e [Form] The trace of form errors is now displayed in the profiler 2014-09-30 23:08:39 +02:00
Bernhard Schussek
541f889d9c feature #12052 [Validator] Made it possible to store the cause of a constraint violation (webmozart)
This PR was merged into the 2.6-dev branch.

Discussion
----------

[Validator] Made it possible to store the cause of a constraint violation

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

This change makes it possible to store the cause of a violation (e.g. an exception). This way it is possible to follow the trace of violations caused by exceptions up to their root.

```php
try {
    // ...
} catch (Exception $e) {
    $this->context->buildViolation('Error!')
        ->setCause($e)
        ->addViolation();
}
```

This is one step to solve #5607. See #12054.

Commits
-------

499eeb4 [Validator] Made it possible to store the cause of a constraint violation
2014-09-30 23:08:00 +02:00
Fabien Potencier
e24a822c40 minor #12080 [EventDispatcher] fix doc bloc on EventDispatcherInterface (nicolas-grekas)
This PR was merged into the 2.3 branch.

Discussion
----------

[EventDispatcher] fix doc bloc on EventDispatcherInterface

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

The doc block says that an array of event names is accepted as input, but no implementation is compliant with that description.

Commits
-------

e3dacbd [EventDispatcher] fix doc bloc on EventDispatcherInterface
2014-09-30 16:01:01 +02:00
Fabien Potencier
6f2e08e32b minor #12078 [HttpKernel] fix composer.json (nicolas-grekas)
This PR was merged into the 2.6-dev branch.

Discussion
----------

[HttpKernel] fix composer.json

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

This fixes the composer.json of HttpKernel

Commits
-------

7bb768d [HttpKernel] fix composer.json
2014-09-30 16:00:26 +02:00
Fabien Potencier
1457e56b74 feature #11496 [MonologBridge] Ignore empty context/extra by default in the ConsoleFormatter (Seldaek)
This PR was merged into the 2.6-dev branch.

Discussion
----------

[MonologBridge] Ignore empty context/extra by default in the ConsoleFormatter

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

This adds support for https://github.com/Seldaek/monolog/pull/388 and turns it on by default since the console output is arguably meant for humans and not for machine readable stuff it makes sense I believe. /cc @Tobion

**Note:** This depends on an unreleased version of monolog and should not be merged until 1.11 is out.

Commits
-------

9b69f56 [MonologBridge] Ignore empty context/extra by default in the ConsoleFormatter
2014-09-30 15:57:56 +02:00
Christophe Coevoet
d7e630aae1 bug #12079 [HttpKernel] Initialize DataCollector data as array (1ed)
This PR was merged into the 2.6-dev branch.

Discussion
----------

[HttpKernel] Initialize DataCollector data as array

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

Without this I'm getting an exception when I open the debug panel without collected data.

```
ContextErrorException: Warning: Invalid argument supplied for foreach()   -
in vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php at line 165

Commits
-------

986df54 [HttpKernel] Initialize DataCollector data as array
2014-09-30 11:53:51 +02:00
Gábor Egyed
986df54c5b [HttpKernel] Initialize DataCollector data as array
This fixes a DumpDataCollector error when the debug panel is opened
without collected data:

ContextErrorException: Warning: Invalid argument supplied for foreach() -
in vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php at line 165
2014-09-30 11:28:36 +02:00
Nicolas Grekas
7bb768dd2a [HttpKernel] fix composer.json 2014-09-30 09:22:58 +02:00
Nicolas Grekas
e3dacbd08c [EventDispatcher] fix doc bloc on EventDispatcherInterface 2014-09-30 09:22:23 +02:00
Fabien Potencier
a8888be8b2 minor #12076 [FrameworkBundle] remove invalid tests (xabbuh)
This PR was merged into the 2.6-dev branch.

Discussion
----------

[FrameworkBundle] remove invalid tests

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

With #12046, the `getLocale()` method isn't overriden anymore by the `Translator` from the FrameworkBundle, but the locale is set by the new `TranslatorListener`. Therefore, the tests ensuring the old behavior are removed.

Commits
-------

80d52c7 remove invalid tests
2014-09-29 22:00:57 +02:00
Fabien Potencier
d0244833e9 minor #12077 [DebugBundle] fix dev dependencies (xabbuh)
This PR was merged into the 2.6-dev branch.

Discussion
----------

[DebugBundle] fix dev dependencies

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

Commits
-------

3454e59 [DebugBundle] fix dev dependencies
2014-09-29 21:59:32 +02:00
Tobias Schultze
6f5748e057 adjust sqlite table definition 2014-09-29 17:13:13 +02:00
Tobias Schultze
5978fcfb08 added upgrade and changelog notes for PdoSessionHandler 2014-09-29 17:13:11 +02:00
Tobias Schultze
182a5d39df [HttpFoundation] add create table method to pdo session handler 2014-09-29 17:13:08 +02:00
Tobias Schultze
e79229d4d3 [HttpFoundation] allow different lifetime per session 2014-09-29 17:13:07 +02:00
Tobias Schultze
af1bb1f6e7 add test for null byte in session data 2014-09-29 17:13:05 +02:00
Tobias Schultze
251238d9a6 [HttpFoundation] implement lazy connect for pdo session handler 2014-09-29 17:13:04 +02:00
Tobias Schultze
7dad54ca08 [HttpFoundation] remove base64 encoding of session data 2014-09-29 17:13:03 +02:00
Fabien Potencier
4b6776e801 feature #12045 [Debug] add some file link format handling (nicolas-grekas)
This PR was merged into the 2.6-dev branch.

Discussion
----------

[Debug] add some file link format handling

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

Commits
-------

c6923af [Debug] add some file link format handling
2014-09-29 16:48:41 +02:00
Christian Flothmann
3454e59ca2 [DebugBundle] fix dev dependencies 2014-09-29 16:05:32 +02:00
Christian Flothmann
80d52c73dc remove invalid tests
With #12046, the `getLocale()` method isn't overriden anymore by the
`Translator` from the FrameworkBundle, but the locale is set by the
new `TranslatorListener`. Therefore, the tests ensuring the old
behavior are removed.
2014-09-29 15:13:53 +02:00
Fabien Potencier
f3ef9d2009 minor #12072 [DependencyInjection] Removed unreachable code (unkind)
This PR was merged into the 2.6-dev branch.

Discussion
----------

[DependencyInjection] Removed unreachable code

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

According to undefined $e, this is an unreachable code. As I can see, circular references are handled by parent method.

Commits
-------

ecedea2 [DependencyInjection] Removed unreachable code
2014-09-29 13:38:42 +02:00
Fabien Potencier
2a8fed6033 minor #12074 [DX] Moved Security constants to a final class instead of a long named interface (iltar)
This PR was merged into the 2.6-dev branch.

Discussion
----------

[DX] Moved Security constants to a final class instead of a long named interface

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

This PR is based on feedback from the documentation repository. The DX suggestion was to rename the new `SecuritySessionStorageInterface` to `Security`. This would make it easier to use the constants before 2.6 is released. In this PR I have also update all usages of this constant because an open PR is now merged which used those constants.

List of changes:
 - SecurityBundle, usage of constants
 - Security Component (core & http), usage of constants
 - Tests, usage of constants
 - Added a test to verify the sync from `Security` to `SecurityContextInterface` for BC purposes

Commits
-------

b23084a [DX] Moved constants to a final class
2014-09-29 12:44:23 +02:00
Iltar van der Berg
b23084abb9 [DX] Moved constants to a final class 2014-09-29 09:38:25 +02:00
Fabien Potencier
4af20505a6 minor #12070 [Validator] Update validators.zh_CN.xlf, fix translation error (michaeljayt)
This PR was submitted for the master branch but it was merged into the 2.3 branch instead (closes #12070).

Discussion
----------

[Validator] Update validators.zh_CN.xlf, fix translation error

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

Commits
-------

ab5aaab [Validator] Update validators.zh_CN.xlf, fix translation error
2014-09-29 08:58:14 +02:00
Michael J
ab5aaab414 [Validator] Update validators.zh_CN.xlf, fix translation error 2014-09-29 08:58:14 +02:00
Fabien Potencier
6e534f2023 bumped Symfony version to 2.5.6 2014-09-28 20:29:08 +02:00
Nikita Konstantinov
ecedea2262 [DependencyInjection] Removed unreachable code 2014-09-28 22:12:33 +04:00
Fabien Potencier
2aef97bbc9 updated VERSION for 2.5.5 2014-09-28 19:33:53 +02:00
Fabien Potencier
33af15518b updated CHANGELOG for 2.5.5 2014-09-28 19:33:46 +02:00
Fabien Potencier
6beca0a945 bumped Symfony version to 2.3.21 2014-09-28 18:55:34 +02:00
Fabien Potencier
5ef0ea8414 updated VERSION for 2.3.20 2014-09-28 18:24:47 +02:00
Fabien Potencier
523b9b78b8 update CONTRIBUTORS for 2.3.20 2014-09-28 18:24:25 +02:00
Fabien Potencier
f0d90031a3 updated CHANGELOG for 2.3.20 2014-09-28 18:24:13 +02:00
Fabien Potencier
1c240067f4 fixed deps 2014-09-28 18:15:31 +02:00
Fabien Potencier
e4b2576610 Merge branch '2.5'
* 2.5:
  fixed deps
  [Debug] fixed class lookup when using PSR-0 with a target dir
  fixed standalone tests
  fixed standalone tests
  [Validator] fixed component standalone tests
  fixed standalone component tests depending on Validator and Form
  fixed some composer.json to make standalone component tests pass
  [SecurityBundle] fixed tests when used in standalone
2014-09-28 18:08:29 +02:00
Fabien Potencier
a4217c3ee0 fixed deps 2014-09-28 17:56:11 +02:00
Fabien Potencier
8d75b4b56f Merge branch '2.4' into 2.5
* 2.4:
  [Debug] fixed class lookup when using PSR-0 with a target dir
  fixed standalone tests
  fixed standalone tests
  [Validator] fixed component standalone tests
  fixed standalone component tests depending on Validator and Form
  fixed some composer.json to make standalone component tests pass
  [SecurityBundle] fixed tests when used in standalone

Conflicts:
	src/Symfony/Component/HttpKernel/Tests/Bundle/BundleTest.php
	src/Symfony/Component/Validator/composer.json
2014-09-28 17:22:14 +02:00
Fabien Potencier
cff4bbbf5d minor #12071 [Debug] fixed class lookup when using PSR-0 with a target dir (fabpot)
This PR was merged into the 2.4 branch.

Discussion
----------

[Debug] fixed class lookup when using PSR-0 with a target dir

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

Commits
-------

f5b38ec [Debug] fixed class lookup when using PSR-0 with a target dir
2014-09-28 17:18:49 +02:00