[TwigBundle] Changed getAndCleanOutputBuffering() handling of systems where ob_get_level() never returns 0

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: [![Build Status](https://secure.travis-ci.org/lencioni/symfony.png)](http://travis-ci.org/lencioni/symfony)
Fixes the following tickets: -
Todo: -

Relying on decrementing a counter has two problems. First, and most importantly, if the output buffering nesting level is greater than the counter, the function does not perform the expected task. Secondly, on systems where the counter is needed, a lot of unnecessary extra loops would potentially occur.

This approach checks to see if the level has stayed the same from the previous iteration and if it has it stops looping.
[TwigBundle] Improved ExceptionController docblocks

Bug fix: no
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: [![Build Status](https://secure.travis-ci.org/lencioni/symfony.png)](http://travis-ci.org/lencioni/symfony)
Fixes the following tickets: -
Todo: -
unused variable removed
merged branch bamarni/master (PR #3670)

Commits
-------

3638c72 unused variable removed

Discussion
----------

[FrameworkBundle] unused variable removed
merged branch aerialls/xliff_fix (PR #3664)

Commits
-------

93d2a4f [Translation] Ignore xliff entries with no "target" node

Discussion
----------

[Translation] Ignore xliff entries with no "target" node

This PR will ignore some entries with no "target" node when a xliff file is loaded.

```xml
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
  <file source-language="en" datatype="plaintext" original="file.ext">
    <body>
      <trans-unit id="1">
        <source>foo</source>
        <target>bar</target>
      </trans-unit>
      <trans-unit id="2">
        <source>extra</source>
      </trans-unit>
    </body>
  </file>
</xliff>
```
Before:

```php
array(
    'foo'   => 'bar',
    'extra' => ''
);
```

After:

```php
array(
    'foo' => 'bar'
);
```

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

by fabpot at 2012-03-21T17:35:51Z

Wouldn't it be better to throw an exception for such cases? A `trans-unit` without a `target` is useless anyway, no?

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

by aerialls at 2012-03-21T20:25:19Z

I'm using transifex (https://www.transifex.net/home/) and when a user doesn't translate an entry, transifex fills up a `trans-unit` node without a `target` children.
merged branch rdohms/upload-validation-details (PR #3637)

Commits
-------

836d12b Fixing typo.
ac2a187 Improved feedback for Upload Validator to cover all PHP error states. This way we don't get a unclear "upload error" message unless its something completely unexpected.

Discussion
----------

Improved feedback for Upload Validator to cover all PHP error states.

The upload validator only sets individual messages for 2 out of the 7 error states PHP suports for uploading files. Which means when you have any of those 5 stats you get a standard error message and have to really dig into the code to read the error state.

I added messages for every state, so that you will always get a detailed message.

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

by stloyd at 2012-03-19T13:54:04Z

You should probably also extend translations in `FrameworkBundle`.

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

by rdohms at 2012-03-19T14:04:50Z

@stloyd what's the best way to do that? I obviously don't speak all languages. Could you point me to a best practices in this case?

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

by stof at 2012-03-19T15:58:17Z

@rdohms update the translations for the languages you speak. Other people will contribute with update later eventually :)

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

by rdohms at 2012-03-19T22:34:50Z

Fixed the typo, only other language i can update is portuguese, but it needs more work. I'll update it on a separate PR later on.

Anything else for this PR?

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

by mvrhov at 2012-03-20T05:41:00Z

@rdohms: just put English strings into other lanugages

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

by rdohms at 2012-03-20T07:35:56Z

@mvrhov is there a quick way to do this? or is it copying and pasting into every language and adjusting the string IDs?

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

by mvrhov at 2012-03-20T09:02:59Z

AFAIK you'll have to copy paste. String ids and source are the same in all translations so it really is just c/p after you update the first one.

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

by rdohms at 2012-03-20T09:56:48Z

@mvrhov so which is the most updated one you would say? i see a lot of them missing bit and pieces :P

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

by mvrhov at 2012-03-20T14:00:21Z

Sorry no idea.

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

by stof at 2012-03-20T19:09:10Z

@mvrhov Please don't do this. The translation component has a fallback mecanism so putting the EN string in an incomplete translation file is a bad idea as it forbids using a fallback.

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

by rdohms at 2012-03-20T20:14:50Z

@stof i figured as much.

Any other concerns before we push this PR further?
fixed previous merge
remove callback from constructor and create method
[FrameworkBundle] added new french validators translations for the File constraint.
[FrameworkBundle] Change XSD to allow string replacements on session args.
[TwigBundle] Added a use statement to shorten class name in a docblock

Bug fix: no
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: [![Build Status](https://secure.travis-ci.org/lencioni/symfony.png)](http://travis-ci.org/lencioni/symfony)
Fixes the following tickets: -
Todo: -
[FrameworkBundle] Updated translations for #3637
merged branch dlsniper/update-validators (PR #3672)

Commits
-------

a1d8ff8 [FrameworkBundle] Updated translations for #3637

Discussion
----------

[FrameworkBundle] Updated translations for #3637

Updated the translations as per #3637.

Thanks.
merged branch hhamon/validators_french_translations (PR #3671)

Commits
-------

00ae766 [FrameworkBundle] added new french validators translations for the File constraint.

Discussion
----------

[FrameworkBundle] added new french validators translations for the File ...

Bug fix: no
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: -
Todo: -
merged branch havvg/feature/jsonp-response (PR #3639)

Commits
-------

4a43453 remove callback from constructor and create method
601b87c add basic validation of callback name
266f76d rename jsonp to callback, defaults to null
38b79a7 add data and callback setter to JsonResponse
6788224 add JSONP support to JsonResponse

Discussion
----------

add JSONP support to JsonResponse

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

by schmittjoh at 2012-03-19T17:56:24Z

I think a ``setCallback()`` method would be more expressive, and easier to use:

```php
<?php

return JsonResponse::create($myData)->setCallback('foo');
// vs
return new JsonResponse($myData, 200, array(), 'foo');
```

What do you think?

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

by havvg at 2012-03-19T18:07:38Z

Looks good to me, I'll add it.

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

by dlsniper at 2012-03-19T19:38:45Z

+1 for this one :)

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

by vicb at 2012-03-19T23:09:50Z

Sorry for nitpicking but what about:

* some validation on the function name ?
* renamming `jsonp` -> `callback` ?

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

by havvg at 2012-03-20T09:16:32Z

@vicb What do you mean with "some validation on the function name"? I can't follow you there.

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

by vicb at 2012-03-20T09:22:49Z

I mean a valid JS function name

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

by havvg at 2012-03-20T09:34:59Z

Ah I see, I searched for it, and ended up with those results:

* The most complete: http://stackoverflow.com/questions/2008279/validate-a-javascript-function-name#answer-9392578
* and a less accurate one: http://www.geekality.net/2011/08/03/valid-javascript-identifier/

I'm not sure whether to put this into the `JsonResponse` itself, or to add somewhere else (where, if so?).

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

by vicb at 2012-03-20T09:45:20Z

I would go for a regexp only (ignoring reserved words); The idea would be not to use this to run arbitrary JS code.

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

by fabpot at 2012-03-21T21:33:36Z

Now that you have added the `setCallback` method, I would remove the constructor argument as it makes the signature quite long. As we have the `create` method anyway, it's more explicit and clearer to use the `setCallback` .

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

by havvg at 2012-03-21T21:37:51Z

So remove the callback argument from both, the constructor and the `create` method or only from the constructor?

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

by havvg at 2012-03-21T21:38:30Z

Ehr.. never mind :-)
[TwigBundle] Made docblock for findTemplate() more general and accurate

Bug fix: no
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: [![Build Status](https://secure.travis-ci.org/lencioni/symfony.png)](http://travis-ci.org/lencioni/symfony)
Fixes the following tickets: -
Todo: -
merged branch Seldaek/process_esc (PR #3631)

Commits
-------

da3a2c4 [Process] Fix command escaping

Discussion
----------

[Process] Fix command escaping

My bad, I misunderstood what escapeshellcmd was good for. This fixes it by properly escaping all args.

The test suite hangs here but it already did before, so I'm not sure if all tests pass.
merged branch lencioni/fix-clean-output-buffering (PR #3667)

Commits
-------

068e859 [TwigBundle] Changed getAndCleanOutputBuffering() handling of systems where ob_get_level() never returns 0

Discussion
----------

[TwigBundle] Changed getAndCleanOutputBuffering() handling of systems where ob_get_level() never returns 0

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: [![Build Status](https://secure.travis-ci.org/lencioni/symfony.png)](http://travis-ci.org/lencioni/symfony)
Fixes the following tickets: -
Todo: -

Relying on decrementing a counter has two problems. First, and most importantly, if the output buffering nesting level is greater than the counter, the function does not perform the expected task. Secondly, on systems where the counter is needed, a lot of unnecessary extra loops would potentially occur.

This approach checks to see if the level has stayed the same from the previous iteration and if it has it stops looping.

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

by fabpot at 2012-03-21T21:29:50Z

Have you encounter this problem to confirm that your approach works?

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

by vicb at 2012-03-21T21:35:39Z

@lencioni could you also provide an answer from my question in the former version of this PR ?

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

by lencioni at 2012-03-21T21:56:06Z

@fabpot I have not encountered this problem personally, but the code I submitted is [similar to an approach I use in SLIR](https://github.com/lencioni/SLIR/blob/master/core/slir.class.php#L462), which has been successful for people who have encountered it.

@vicb You are referring to [this question](https://github.com/symfony/symfony/pull/3666#issuecomment-4626105), right?

>It was possible than the body of the while loop was never executed before, it is no more. Is this expected ?

I think you may have misinterpreted the change I submitted. In the original code, there were two conditions being checked in the while loop. The first condition has not changed in my code and could still prevent the body of the while loop from being never executed. The second condition in the original code would always evaluate to 99 on the first iteration, which would not prevent the loop from running.

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

by vicb at 2012-03-21T22:00:01Z

oops my mistake, sorry.
Added Croatian validator translation for 2.0
merged branch aubx/croatian_validator_translation_2_0 (PR #3676)

Commits
-------

d42ae47 Added Croatian validator translation for 2.0

Discussion
----------

[FrameworkBundle][translations]Croatian validator translation