[Config] Numerical keys for prot. arrays if useAttributeAsKey is set
[Form] Added valid attribute to a FormView
Modified example for mod_rewrite to not add Authorization header if it is not set in the request
merged branch kevindew/form_view_errors (PR #4224)

Commits
-------

e92212a [Form] Added valid attribute to a FormView

Discussion
----------

[Form] Added "valid" to view parameters

Bug fix: no
Feature addition: yes
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets:
Todo:
License of the code: MIT
Documentation PR:

This PR adds a parameter of contains_errors to a FormView when buildView is called.

The use case for this addition is when you want to show that a form or sub forms has errors (e.g. when rendering a long form a header message of "This form contains errors" or adding a class to a whole sub form to show an erroneous state) is currently very difficult/near impossible and may need the original form object being accessible in the view layer.

Whats a bit grey here is the best phrasing to use for this. Options I weighed up were is_valid (seemed a bit semantically incorrect in a template, since it would return true pre bind) and has_errors_deep (which i wasn't sure if it fitted naming conventions).

---------------------------------------------------------------------------

by travisbot at 2012-05-07T20:25:55Z

This pull request [fails](http://travis-ci.org/symfony/symfony/builds/1269345) (merged fe1f5aee into 919604ab).

---------------------------------------------------------------------------

by henrikbjorn at 2012-05-19T18:36:33Z

couldnt you just use `{% if errors %}` in your views?

---------------------------------------------------------------------------

by stof at 2012-05-19T19:17:20Z

@henrikbjorn ``errors`` contains only the errors attached to the form itself. It will not tell you when there is some errors in a child form.

---------------------------------------------------------------------------

by kevindew at 2012-05-22T10:43:45Z

Sure, done

---------------------------------------------------------------------------

by travisbot at 2012-05-22T10:45:12Z

This pull request [passes](http://travis-ci.org/symfony/symfony/builds/1399006) (merged 9f6658d4 into 517ae43f).

---------------------------------------------------------------------------

by kevindew at 2012-05-22T10:57:54Z

Shoot, sorry about that.

---------------------------------------------------------------------------

by travisbot at 2012-05-22T11:00:00Z

This pull request [passes](http://travis-ci.org/symfony/symfony/builds/1399096) (merged 88920591 into 517ae43f).

---------------------------------------------------------------------------

by bschussek at 2012-05-22T11:17:38Z

Can you squash the commits and prefix the message with "[Form]" please?

---------------------------------------------------------------------------

by travisbot at 2012-05-22T11:49:52Z

This pull request [fails](http://travis-ci.org/symfony/symfony/builds/1399390) (merged ca771822 into 517ae43f).

---------------------------------------------------------------------------

by kevindew at 2012-05-22T11:53:18Z

Sure, done (I've sorted the travis fail btw)

---------------------------------------------------------------------------

by travisbot at 2012-05-22T11:55:10Z

This pull request [passes](http://travis-ci.org/symfony/symfony/builds/1399404) (merged e92212ac into 517ae43f).

---------------------------------------------------------------------------

by bschussek at 2012-05-22T12:25:45Z

@fabpot :+1:
merged branch grEvenX/authorization_example_fix (PR #4370)

Commits
-------

0935964 Modified example for mod_rewrite to not add Authorization header if it is not set in the request

Discussion
----------

Correct example mod_rewrite to not add Authorization header that does not exists

The in-line PHP code comment suggest to do some changes in .htaccess with mod_rewrite to pass HTTP-Authorization header to PHP. This leads to the Authorization header being introduced even when it's not originally in the request (albit empty, the result of ParameterBag->has('Authorization') will return true when you expect it not to.
Some external libraries might check for this header and perform logic based on wether it was set or not (The php-oauth2 library in my case).

I suggest this fix which I think is a more proper way of handling the case anyway, since when the header is not set you don't expect it to exist in the ServerBag either.

(I tried to search the documentation for this but did not find it, but I guess this probably should go into the documentation somewhere?)

---------------------------------------------------------------------------

by travisbot at 2012-05-22T12:51:25Z

This pull request [passes](http://travis-ci.org/symfony/symfony/builds/1399753) (merged 0935964b into 517ae43f).
merged branch asm89/numeric-keys-config (PR #4276)

Commits
-------

b7fc009 [Config] Numerical keys for prot. arrays if useAttributeAsKey is set

Discussion
----------

[Config] Numerical keys for prot. arrays if useAttributeAsKey is set

Bug fix: not sure
Feature addition: not sure
Backwards compatibility break: not sure
Symfony2 tests pass: [![Build Status](https://secure.travis-ci.org/asm89/symfony.png?branch=numeric-keys-config)](http://travis-ci.org/asm89/symfony)
License of the code: MIT

When using an array node with children of prototype array and `useAttributeAsKey`, using numerical values for the keys throws an exception. For example (`useAttributeAsKey('id')`):

``` php
<?php
// works
array (
    'thing' => array(
        array('foo', 'bar', 'id' => 'a')
    )
);

// works and is the same as above
array (
    'thing' => array(
        'a' => array('foo', 'bar')
    )
);

// works
array(
    'thing' => array(
        array('foo', 'bar', 'id' => 42), array('baz', 'qux', 'id' => 1337),
    ),
);

// works with this patch and is the same as above
array(
    'thing' => array(
        42 => array('foo', 'bar'), 1337 => array('baz', 'qux'),
    ),
);
```

---------------------------------------------------------------------------

by travisbot at 2012-05-14T14:26:32Z

This pull request [passes](http://travis-ci.org/symfony/symfony/builds/1327383) (merged 42d252da into 46ffbd52).

---------------------------------------------------------------------------

by travisbot at 2012-05-14T14:32:59Z

This pull request [passes](http://travis-ci.org/symfony/symfony/builds/1327430) (merged b7fc0093 into 46ffbd52).

---------------------------------------------------------------------------

by vicb at 2012-05-21T15:16:24Z

Could this be fixed by changing [PrototypedArrayNode](https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Config/Definition/PrototypedArrayNode.php#L255)
`$k = $v[$this->keyAttribute];` -> `$k = (string) $v[$this->keyAttribute];`

---------------------------------------------------------------------------

by asm89 at 2012-05-22T07:01:53Z

I tried it and the test I added still fails. The code change you propose doesn't execute because `if (!isset($v[$this->keyAttribute]) && is_int($k))` will still evaluate to true.
[Form] Fixed strict "data_class" check to work with instances of \ArrayAccess
merged branch bschussek/dataclassfix (PR #4374)

Commits
-------

82c221a [Form] Fixed strict "data_class" check to work with instances of \ArrayAccess

Discussion
----------

[Form] Fixed collection type to work with recent Form changes

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: -
Todo: -

---------------------------------------------------------------------------

by tristanbes at 2012-05-22T16:42:36Z

Ping @fabpot Could you please merge it ASAP, because this bugs breaks all forms containing collection type.

Thanks

---------------------------------------------------------------------------

by travisbot at 2012-05-22T16:54:24Z

This pull request [passes](http://travis-ci.org/symfony/symfony/builds/1401580) (merged 82c221a1 into 1a1403f5).