Commit Graph

16790 Commits

Author SHA1 Message Date
Eduardo Gulias Davis
e79b3a9755 Change in validator.email service alias to match the validator FQCN 2014-03-30 09:34:45 +02:00
Fabien Potencier
3cd1c9cd5b bug #10565 fixed typos (fabpot)
This PR was merged into the 2.5-dev branch.

Discussion
----------

fixed typos

/cc @nicolas-grekas

Commits
-------

584b5c0 fixed typos
2014-03-28 10:40:08 +01:00
Fabien Potencier
584b5c0508 fixed typos 2014-03-28 10:40:08 +01:00
Fabien Potencier
4a0382b58a fixed CS 2014-03-27 21:36:23 +01:00
Fabien Potencier
9e78a0603e Merge branch '2.4'
* 2.4:
  added missing unit test
  fixed too greedy replacements
  fixed protocol-relative URLs
  added override power to server parameters provided on request method
  made parsing controllers more robust
  Fixed YamlFileLoader imports path
2014-03-27 15:53:24 +01:00
Fabien Potencier
82cbf698b7 Merge branch '2.3' into 2.4
* 2.3:
  added missing unit test
  fixed too greedy replacements
  fixed protocol-relative URLs
  added override power to server parameters provided on request method
  made parsing controllers more robust
  Fixed YamlFileLoader imports path

Conflicts:
	src/Symfony/Component/HttpKernel/Tests/Controller/ControllerResolverTest.php
2014-03-27 15:53:17 +01:00
Fabien Potencier
ea4b8bf993 minor #10558 [DependencyInjection] added missing unit test (fabpot)
This PR was merged into the 2.3 branch.

Discussion
----------

[DependencyInjection] added missing unit test

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

Added a unit test to ensure that #10536 won't break BC.

Commits
-------

47d1592 added missing unit test
2014-03-27 15:52:08 +01:00
Fabien Potencier
47d1592b56 added missing unit test 2014-03-27 15:52:07 +01:00
Fabien Potencier
b78d1746f0 minor #10554 framework_bundle -> framework (mvrhov)
This PR was merged into the 2.5-dev branch.

Discussion
----------

framework_bundle -> framework

Commits
-------

85cf7a7 framework_bundle -> framework
2014-03-27 14:47:58 +01:00
Miha Vrhovnik
85cf7a762c framework_bundle -> framework 2014-03-27 14:47:58 +01:00
Fabien Potencier
e505ecdacd feature #10370 [FrameworkBundle][Console] Add parameter descriptors (inalgnu)
This PR was squashed before being merged into the 2.5-dev branch (closes #10370).

Discussion
----------

[FrameworkBundle][Console] Add parameter descriptors

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

I've added several descriptors for each format, henceforth :
``php app/console container:debug --parameter=database_name --format=txt`` will output:
``symfony``

``php app/console container:debug --parameter=database_name --format=json`` will output:
```json
{
    "database_name": "symfony"
}
```

``php app/console container:debug --parameter=database_name --format=xml`` will output :
```xml
<?xml version="1.0" encoding="UTF-8"?>
<parameter key="database_name">symfony</parameter>
```
and ``php app/console container:debug --parameter=database_name --format=md`` will output :
```md
database_name
=============

symfony
```

what do you think ?

Commits
-------

6aa1050 Add parameter descriptors
2014-03-27 12:26:27 +01:00
Inal DJAFAR
6aa1050793 Add parameter descriptors 2014-03-27 12:26:27 +01:00
Fabien Potencier
0380d1456a bug #10549 Fixed server values in BrowserKit (fabpot)
This PR was merged into the 2.3 branch.

Discussion
----------

Fixed server values in BrowserKit

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

Commits
-------

65b9810 fixed too greedy replacements
d9cf28d fixed protocol-relative URLs
289da16 added override power to server parameters provided on request method
2014-03-27 10:14:18 +01:00
Fabien Potencier
65b98102d1 fixed too greedy replacements 2014-03-27 10:14:18 +01:00
Fabien Potencier
d9cf28d016 fixed protocol-relative URLs 2014-03-27 10:14:18 +01:00
Luis Cordova
289da16681 added override power to server parameters provided on request method 2014-03-27 10:14:17 +01:00
Fabien Potencier
4a06daf2c3 feature #9818 [TwigBundle] Add command to list twig functions, filters, globals and tests (Seldaek)
This PR was squashed before being merged into the 2.5-dev branch (closes #9818).

Discussion
----------

[TwigBundle] Add command to list twig functions, filters, globals and tests

Sample output:

```
$ app/console twig:doc date
Functions
  date(date = null, timezone = null)

Filters
  date(format = null, timezone = null)
  date_modify(modifier)
```

JSON output also available, could be helpful for IDEs.

Possible improvement would be to read the first line of the docblock of each method/function to show a bit more info.

Feedback welcome on the command's name. Not really convinced but too late to think of something better.

Credits to @gagarine for the great idea

Commits
-------

7d61154 Add command to list twig functions, filters, globals and tests
2014-03-27 08:58:32 +01:00
Jordi Boggiano
7d61154e7a Add command to list twig functions, filters, globals and tests 2014-03-27 08:58:32 +01:00
Fabien Potencier
9068875a5e bug #10540 [HttpKernel] made parsing controllers more robust (fabpot)
This PR was merged into the 2.3 branch.

Discussion
----------

[HttpKernel] made parsing controllers more robust

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

Under some circumstances (like passing an object without an __invoke method), the Controller resolver would lead to a PHP fatal. This PR fixes that, improved error messages, and refactored the unit tests.

Commits
-------

6dba229 made parsing controllers more robust
2014-03-27 08:52:42 +01:00
Fabien Potencier
6dba2296f1 made parsing controllers more robust 2014-03-27 08:52:42 +01:00
Fabien Potencier
caabd415b1 feature #10546 [Validator] Improved ISBN validator (sprain)
This PR was merged into the 2.5-dev branch.

Discussion
----------

[Validator] Improved ISBN validator

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | yes
| Tests pass?   | yes
| Fixed tickets | #10386, #10387, #10542
| License       | MIT
| Doc PR        | symfony/symfony-docs/pull/3724

This is a new PR of #10542, now on master branch.

Todos:
- [x] Discuss and determine deprecation versions
- [x] Update docs

After following some discussion in the tickets mentioned above I have improved the ISBN validator, which has had some inconsistencies:

* Use a `type` which can be set to `isbn10` or `isbn13` or `null` (checks if value matches any type) instead of the current boolean `isbn10` and `isbn13` options which cause confusion (e.q. if both are true, does this mean the value must match any or both? You could think it's the latter, but that's actually impossible.).
* In the IBAN validator we recently agreed to be strict about upper- and lowercase handling (#10489). Therefore this should be also the case with the ISBN validator. Some ISBN10 numbers may end with an uppercase `X` (representing the check-digit 10), while a lowercase `x` is considered wrong (see [here](http://www.goodreads.com/topic/show/1253500-a-question-about-isbn-10-s---ending-in-x) and [here](http://en.wikipedia.org/wiki/Category:Pages_with_ISBN_errors)). I did not have access to the actual specifications as I have only found documentation which costs about $100 (e.q. [here](http://www.iso.org/iso/catalogue_detail?csnumber=36563)).

To avoid bc breaks I suggest to introduce deprecations for current constraint options. [In the documentation](http://symfony.com/doc/current/contributing/code/conventions.html#deprecations) I haven't found any information about which versions may introduce deprecations, so you might have to help me out here with hints on how to handle it correctly. I'll be happy to provide the code with the deprecated parts removed after that.

Commits
-------

ec42844 Improved ISBN validator
2014-03-27 08:46:44 +01:00
Manuel Reinhard
ec428445a1 Improved ISBN validator 2014-03-27 08:46:43 +01:00
Fabien Potencier
711788b794 fixed CS 2014-03-27 08:45:48 +01:00
Fabien Potencier
cb147eccb2 feature #10457 [Serializer] Unify usage of normalizer cache (Berdir)
This PR was squashed before being merged into the 2.5-dev branch (closes #10457).

Discussion
----------

[Serializer] Unify usage of normalizer cache

| Q             | A
| ------------- | ---
| Bug fix?      | no (unless performance problems are considered bugs)
| New feature?  | no
| BC breaks?    | no (unless the exception structure should be simplified)
| Deprecations? | no
| Tests pass?   | yes ( I had some test fails locally when running the whole suite, but not related to Serializer)
| Fixed tickets |
| License       | MIT
| Doc PR        |

Some clean-up of the Serialization class, which has methods to get the Normalizer/Denormalizer but then repeats that logic in normalizeObject()/denormalizeObject().

Took great care to keep the exception behavior exactly like it is now as the tests depend on it, but it's strange (the methods use different exception classes if no normalizer is found and the "no normalizer" LogicException only exists in normalizeObject/denomalizeObject. That could easily be simplified further, to the point where those functions could easily be merged into the calling methods, as it would just be a single line of code. There is also a duplicate call to $this->normalizeObject() in normalize() that just exists to throw the LogicException for Symfony\Component\Serializer\Tests\SerializerTest::testSerializeNoNormalizer. Other tests do not except that to be thrown there, though.

Also noticed that getNormalizer()/getDenormalizer() are documented as @inheritdocs, which is a lie as they are private. Added some basic docs there.

This is performance relevant, as not having the cache in the getter methods means all normalizers are checked again to verify if a normalizer supports the data.

Commits
-------

e7389aa Move normalizer cache to getNormalier()/getDenormalizer(), use those in normalizeObject()/denormalizeObject()
2014-03-27 08:44:58 +01:00
Sascha Grossenbacher
e7389aa24c Move normalizer cache to getNormalier()/getDenormalizer(), use those in normalizeObject()/denormalizeObject() 2014-03-27 08:44:58 +01:00
Fabien Potencier
e4ff8ae22f bug #10545 [DependencyInjection] Fixed YamlFileLoader imports path (jrnickell)
This PR was merged into the 2.3 branch.

Discussion
----------

[DependencyInjection] Fixed YamlFileLoader imports path

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #10516
| License       | MIT
| Doc PR        | http://symfony.com/doc/current/book/service_container.html#importing-configuration-with-imports

YamlFileLoader used the resource name as the current directory during import, which can cause a failed import when using a relative path. Using the $path variable output from the locator is consistent with other loaders and fixes the bug.

Commits
-------

fd1d48b Fixed YamlFileLoader imports path
2014-03-27 08:28:37 +01:00
John Nickell
fd1d48b54f Fixed YamlFileLoader imports path
YamlFileLoader used the resource name as the current directory during import, which can cause a failed import when using a relative path. Using the $path variable output from the locator is consistent with other loaders and fixes the bug.
2014-03-27 08:28:37 +01:00
Fabien Potencier
5a4885edb4 feature #9140 [Validator][Email] - Strict validation and soft dependency (egulias)
This PR was squashed before being merged into the 2.5-dev branch (closes #9140).

Discussion
----------

[Validator][Email] - Strict validation and soft dependency

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | yes
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #1581, #4930
| License       | MIT
| Doc PR        | https://github.com/symfony/symfony-docs/pull/3469

TODO
---------
- [x] submit changes to the documentation
- [x] document the BC breaks
- [x] finish the code
- [x] gather feedback for my changes

In #1581 @bschussek suggested to pass the strict_email config to  `Validator\EmailValidator::__construct($strict)`, I did not put it there yet since the constraint can receive that configuration each time the constraint is used despite the fact of the global configuration. This could lead to some logic in the constructor and I wanted first to integrate the strict validator.

BC Break
--------------
I'm not sure of this, but as a soft dependency is added and now some emails that where valid before no longer are I thought it is.

Commits
-------

3368630 #1581 - Strict in Email constraint and use of Egulias\EmailValidator
2014-03-27 07:02:36 +01:00
Eduardo Gulias Davis
3368630482 #1581 - Strict in Email constraint and use of Egulias\EmailValidator 2014-03-27 07:02:30 +01:00
Fabien Potencier
e0de9586aa Merge branch '2.4'
* 2.4:
  Check headers sent before sending PHP response
  Fix issue symfony/symfony#10345 '[FrameworkBundle][Console] container:debug --parameter="" not working anymore'
  Fixed ACE domain checks on UrlValidator (#10031)
  handle array root element
2014-03-26 19:07:49 +01:00
Fabien Potencier
af6d11c9c6 Merge branch '2.3' into 2.4
* 2.3:
  Check headers sent before sending PHP response
  Fixed ACE domain checks on UrlValidator (#10031)
  handle array root element
2014-03-26 19:07:42 +01:00
Fabien Potencier
58f5f4afb4 bug #10523 [Debug] Check headers sent before sending PHP response (GromNaN)
This PR was merged into the 2.3 branch.

Discussion
----------

[Debug] Check headers sent before sending PHP response

If the response contents has been sent before an error occurs, PHP triggers the warning "Cannot modify header information - headers already sent".

This change ensure that the useful error message is echoed, while it's impossible to change the HTTP status code and headers.

| 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
-------

97591c1 Check headers sent before sending PHP response
2014-03-26 19:06:50 +01:00
Jerome TAMARELLE
97591c1b30 Check headers sent before sending PHP response
If the response contents has been sent before an error occurs, PHP
triggers the warning "Cannot modify header information - headers already sent"

This change ensure that the error message is echoed, while it's impossible
to change the HTTP status code and headers.
2014-03-26 19:06:50 +01:00
Fabien Potencier
830ab242c7 minor #10527 [HttpKernel] [Exception] Add UnprocessableEntityHttpException to HttpKernel Exceptions (steveYeah)
This PR was merged into the 2.5-dev branch.

Discussion
----------

[HttpKernel] [Exception] Add UnprocessableEntityHttpException to HttpKernel Exceptions

Add UnprocessableEntityHttpException, as this would have been useful as few times now.

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

Commits
-------

304cbe9 Add UnprocessableEntityHttpException to HttpKernel Exceptions
2014-03-26 19:03:23 +01:00
steveYeah
304cbe99fe Add UnprocessableEntityHttpException to HttpKernel Exceptions 2014-03-26 19:03:23 +01:00
Fabien Potencier
69fa1da19e bug #10363 [FrameworkBundle][Console] Fix issue #10345 container:debug --parameter="" not working anymore (FineWolf)
This PR was merged into the 2.4 branch.

Discussion
----------

[FrameworkBundle][Console] Fix issue #10345 container:debug --parameter="" not working anymore

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

## TODO
- [x] Fix issue #10345
- [ ] Create unit test for `describeContainerParameter`

Commits
-------

b278aa4 Fix issue symfony/symfony#10345 '[FrameworkBundle][Console] container:debug --parameter="" not working anymore'
2014-03-26 18:53:45 +01:00
Andrew Moore
b278aa4b02 Fix issue symfony/symfony#10345 '[FrameworkBundle][Console] container:debug --parameter="" not working anymore' 2014-03-26 18:53:45 +01:00
Fabien Potencier
3ab2dd7076 feature #10291 [Validator] New validator for UUIDs (colinodell)
This PR was submitted for the 2.3 branch but it was merged into the 2.5-dev branch instead (closes #10291).

Discussion
----------

[Validator] New validator for UUIDs

This PR adds a new validator for [RFC 4122](http://tools.ietf.org/html/rfc4122)-compliant [universally unique identifiers (UUIDs)](https://en.wikipedia.org/wiki/Universally_unique_identifier).  This implementation validates both the format and (optionally) the UUID version.

The RFC is very specific on how UUIDs should be formatted.  However, some systems/platforms like PostgreSQL produce or allow similar but non-compliant UUIDs which some developers may need to allow.  (Their dashes are in different spots, or they might be wrapped in curly braces, but still contain the same number of hexadecimal characters). To accommodate both parties, I've added a `strict` option to the constraint.  When enabled (default), the validator only allows UUIDs conforming to the exact RFC specs.

Comments and feedback would be greatly appreciated :)

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

**TODOs:**

 - [x] Gather feedback; make changes
 - [x] Ensure all tests pass
 - [ ] Get approval; have this added to the 2.5 milestone
 - [x] Submit PR for the documentation

Commits
-------

19931c9 Added new validator for UUIDs
2014-03-26 18:50:25 +01:00
Colin O'Dell
19931c984c Added new validator for UUIDs 2014-03-26 18:50:25 +01:00
Fabien Potencier
26d4db3e8b bug #10275 [Validator] Fixed ACE domain checks on UrlValidator (#10031) (aeoris)
This PR was merged into the 2.3 branch.

Discussion
----------

[Validator] Fixed ACE domain checks on UrlValidator (#10031)

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

I added some checks to allow internationalised domain names as per reported on #10031 and some extra testcases to cover ACE domain names.

Commits
-------

7a2f154 Fixed ACE domain checks on UrlValidator (#10031)
2014-03-26 18:48:23 +01:00
Diego Agulló
7a2f154533 Fixed ACE domain checks on UrlValidator (#10031) 2014-03-26 18:48:23 +01:00
Fabien Potencier
22caebcd8e bug #10123 handle array root element (greg0ire)
This PR was submitted for the 2.4 branch but it was merged into the 2.3 branch instead (closes #10123).

Discussion
----------

handle array root element

An array to string conversion notice was thrown when the root element of the thing being validated is an array.

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

Commits
-------

17ed8bf handle array root element
2014-03-26 18:31:52 +01:00
Grégoire Paris
17ed8bf563 handle array root element
An array to string conversion notice was thrown when the root element of
the thing being validated is an array.
2014-03-26 18:31:52 +01:00
Fabien Potencier
790ba4cb3d feature #10534 [SwiftMailer] [MonologBundle] send error log mails from CLI (arodiss)
This PR was merged into the 2.5-dev branch.

Discussion
----------

[SwiftMailer] [MonologBundle] send error log mails from CLI

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

Given I have symfony2 application with Monolog configured to send mail on error logs.
When I have exception thrown from CLI task
Then I should receive error mail

However this is not true because `Monolog/SwiftMailerHandler` is doing force flush only on `kernel.terminate`, but not on `console.terminate`

This PR fixes issue together with https://github.com/symfony/MonologBundle/pull/73

Commits
-------

9bb602f added explicit swiftmailer flush after ConsoleEvents::TERMINATE
2014-03-26 15:23:10 +01:00
Gleb Sidora
9bb602fdd5 added explicit swiftmailer flush after ConsoleEvents::TERMINATE 2014-03-26 15:23:10 +01:00
Fabien Potencier
9dc14a5c2b feature #10513 [Bridge][Propel1][Form] Model choice accept custom unique column (cedriclombardot)
This PR was merged into the 2.5-dev branch.

Discussion
----------

[Bridge][Propel1][Form] Model choice accept custom unique column

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

This PR permit to do :

```` php
<?php
public function buildForm(FormBuilderInterface $builder, array $options)
{
    $builder->add('my_field', 'model', array(
                        'class' => 'MyClassWithSlug',
                        'index_property' => 'slug'
    ));
}
````

With this option you can hide internal ids to expose an unique column eg slug and render

```` html
<select name="my_field">
      <option value="{THE_SLUG}">{THE_VALUE}</option>
</select>
````

Commits
-------

81e94d0 Model choice accept custom unique column
2014-03-26 15:17:29 +01:00
Cedric LOMBARDOT
81e94d084b Model choice accept custom unique column
Use now ->add('my_field', 'model', array('class' => 'MyClassWithSlug', 'index_property' => 'slug'));
To make choice list keys as slug
2014-03-26 15:17:28 +01:00
Fabien Potencier
3b95d09542 bug #10535 [Form] Fixed tests after merging pattern deprecation (stefanosala)
This PR was merged into the 2.5-dev branch.

Discussion
----------

[Form] Fixed tests after merging pattern deprecation

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

Tests were not run on #10001.
Here are some fixes.

Commits
-------

e2d8944 Fixed tests after merging pattern deprecation
2014-03-26 14:16:34 +01:00
Stefano Sala
e2d8944076 Fixed tests after merging pattern deprecation 2014-03-26 14:16:33 +01:00
Fabien Potencier
58bdf842b7 Merge branch '2.4'
* 2.4:
  [DomCrawler] fixed wrong merge
  [Filesystem] fixed a test broken after merging the 2.3 branch
2014-03-26 13:01:00 +01:00