Commit Graph

11596 Commits

Author SHA1 Message Date
Fabien Potencier
2a23dbdeb6 [HttpKernel] fixed some broken tests 2012-10-29 18:07:35 +01:00
Fabien Potencier
27ee8468fe merged branch ramsey/feature/additional-http-exceptions (PR #5312)
This PR was squashed before being merged into the master branch (closes #5312).

Commits
-------

e0c4d99 [HttpKernel] Additional HTTP exceptions

Discussion
----------

[HttpKernel] Additional HTTP exceptions

I wanted to continue using exceptions for many other types of HTTP 4xx and 5xx status codes, particularly because I like the notion that I can trap the exception based on the type, rather than inspecting HttpException to see what status code it contains. I've decided to contribute these back to the Symfony HttpKernel component, in case others find them useful.

* 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: n/a

This pull request provides the following new HttpKernel Exceptions:

Exception                          | Applicable HTTP Status Code
---------------------------------- | ---------------------------------------
BadRequestHttpException            | `400 Bad Request`
ConflictHttpException              | `409 Conflict`
GoneHttpException                  | `410 Gone`
InternalServerErrorHttpException   | `500 Internal Server Error`
LengthRequiredHttpException        | `411 Length Required`
NotAcceptableHttpException         | `406 Not Acceptable`
PreconditionFailedHttpException    | `412 Precondition Failed`
PreconditionRequiredHttpException  | `428 Precondition Required`†
ServiceUnavailableHttpException    | `503 Service Unavailable`
TooManyRequestsHttpException       | `429 Too Many Requests`†
UnauthorizedHttpException          | `401 Unauthorized`
UnsupportedMediaTypeHttpException  | `415 Unsupported Media Type`

All the tests have been placed in the FlattenExceptionTest, since that's where the previous status code and method tests for HttpException exceptions are located, but I can move them to a more logical location, if needed.

† These codes have been included from [RFC 6585, Additional HTTP Status Codes](http://tools.ietf.org/html/rfc6585).

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

by stof at 2012-08-21T23:10:45Z

I would remove the InternalServerError one, as you get a 500 for any non-http exception anyway

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

by stof at 2012-08-21T23:11:34Z

and please rebase your branch to get rid of the merge commit at the beginning of your PR

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

by ramsey at 2012-10-03T20:22:59Z

@stof Can you provide some pointers on how to get rid of the merge commit through a rebase? I generally avoid rebase, so doing this is fairly new to me. I realize that what created the commit was a non-fast-forward merge, so I just need to understand how to get it to apply merges cleanly without creating merge commits like that. Thanks!

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

by alexandresalome at 2012-10-04T07:14:00Z

@ramsey

    # suppose you are on branch-feature
    # given origin is the symfony repository
    git pull --rebase origin/master

    # equivalent to
    git fetch origin
    git rebase origin/master

If you want to rebase your branch on 2.1:

    git pull --rebase origin/2.1

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

by stof at 2012-10-04T18:52:22Z

@ramsey http://symfony.com/doc/current/contributing/code/patches.html#rework-your-patch for the documentation about the way to do it

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

by stof at 2012-10-13T20:44:26Z

@ramsey ping

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

by fabpot at 2012-10-29T09:47:36Z

I'm going to finish this PR, but #5862 should be merged first.

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

by ramsey at 2012-10-29T15:36:31Z

Sorry I've been sitting on this for so long. I haven't had time to figure out how to get rid of the merge commit, as @stof requested. That's the only outstanding issue here, as far as I know.

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

by fabpot at 2012-10-29T15:47:54Z

I can see another issue. For some HTTP codes, you can/should/must add some headers or some content (like for the 406 status code).

Don't worry about the merge commit or the rebasing, I will take care of that myself when merging the PR.

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

by ramsey at 2012-10-29T16:05:04Z

I don't know what header is required for the 406 status code. RFC 2616 doesn't specify one. It does say "the response should include an entity containing a list of available entity characteristics and locations."

In other exceptions, such as UnauthorizedHttpException, TooManyRequestsHttpException, and ServiceUnavailableException, I did provide the required headers.

On Monday, October 29, 2012 at 10:48 AM, Fabien Potencier wrote:

> I can see another issue. For some HTTP codes, you can/should/must add some headers or some content (like for the 406 status code).
> Don't worry about the merge commit or the rebasing, I will take care of that myself when merging the PR.
>
> —
> Reply to this email directly or view it on GitHub (https://github.com/symfony/symfony/pull/5312#issuecomment-9871877).
>
>
>
2012-10-29 17:12:57 +01:00
Ben Ramsey
4e826c7486 [HttpKernel] added some more HTTP exceptions 2012-10-29 17:11:00 +01:00
Fabien Potencier
c4c5d3c02d merged branch jakzal/yamlDoubleQuotesDumperFix (PR #4320)
Commits
-------

b631073 [Yaml] Fixed double quotes escaping in Dumper.

Discussion
----------

[Yaml] Fixed double quotes escaping in Dumper

Issue #4308 is caused by Dumper::escapeWithDoubleQuotes() which uses [str_replace()](http://php.net/str_replace).

From the php docs:

> Because str_replace() replaces left to right, it might replace a previously inserted value when doing multiple replacements.

We should be very careful in deciding about the order of elements in $escapees array. I'd really appreciate if someone reviewed my fix. Tests say I didn't break anything but I'm not sure what percentage of Yaml specification is covered by tests.

Bug fix: yes
Feature addition: no
Backwards compatibility break: not that I know
Symfony2 tests pass: [![Build Status](https://secure.travis-ci.org/jakzal/symfony.png?branch=yamlDoubleQuotesDumperFix)](http://travis-ci.org/jakzal/symfony)
Fixes the following tickets: #4308

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

by travisbot at 2012-05-18T08:53:51Z

This pull request [passes](http://travis-ci.org/symfony/symfony/builds/1364279) (merged 5192722c into a04acc89).

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

by travisbot at 2012-05-18T23:19:49Z

This pull request [fails](http://travis-ci.org/symfony/symfony/builds/1371539) (merged ecaa1aab into fc3c609b).

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

by dinamic at 2012-05-19T07:35:21Z

Something is really wrong with this method. You can see clearly that multiple characters would fail proper escaping.

Here's an example:
```
$value = '\\\\"some value\n \"some quoted string\" and \'some single quotes one\'"';
var_dump(Escaper::escapeWithDoubleQuotes($value));
string(72) ""\\\"some value\n \\some quoted string\\ and 'some single quotes one'\"""
```

To begin with the backslash - in the initial value you have 2 (escaped ones), that after escaping should result in 4, not in 1 (escaped). I guess this behavior has to be verified with the importer, but imho it does not seem right.

Does anyone know why this escaping wasn't done using a regular expression in first place?

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

by clemens-tolboom at 2012-05-19T10:18:58Z

Searching for https://duckduckgo.com/?q=what+is+\xc2\x85 the table on http://stackoverflow.com/questions/6609895/efficiently-replace-bad-characters is interesting enough to decide we need way more documentation on this file.

\xc2\x85 seems to be triple dot (ellipses)
\xe2\x80\xa9 seems to be paragraph separator see http://drupal.org/node/914360#comment-3468550

Conflicts:
	src/Symfony/Component/Yaml/Escaper.php
2012-10-29 12:15:41 +01:00
Fabien Potencier
7322696378 merged branch niklasf/binary-file-response (PR #4546)
This PR was merged into the master branch.

Commits
-------

2f7bbbf [HttpFoundation] Added BinaryFileResponse.

Discussion
----------

[2.2] [HttpFoundation] Added BinaryFileResponse.

Another stab at #3602, based on @stealth35's code at https://gist.github.com/1472230.

- Move things around a little, clean things up, looking how it has been done in StreamedResponse.
- Add tests.
- Make functions chainable.
- Add a flag whether or not to trust the X-Sendfile-Type header.

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

by Partugal at 2012-06-10T19:56:43Z

What about support X-Accel-Redirect (nginx)?

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

by niklasf at 2012-06-10T20:41:10Z

@Partugal: So we support X-Sendfile-Type to pick the X-Sendfile header. What else would be needed to support X-Accel-Redirect (which we should definitely do)?

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

by Partugal at 2012-06-10T21:29:41Z

@niklasf Because nginx not use full file path, this need X-Accel-Mapping header (http://rack.rubyforge.org/doc/Rack/Sendfile.html)

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

by niklasf at 2012-06-10T22:45:38Z

@Partugal: Alright. Doing such a substitution now. Also added a test for that.

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

by stealth35 at 2012-06-11T07:47:35Z

I think the MIME should be base on the extensions map, for an example with `xlsx` that send an `application/zip` or a `xlsx` file MIME is `application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`

Client to server : Reverve MIME => libmagic
Server to client : MIME => MIME map

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

by niklasf at 2012-06-11T14:40:00Z

@partugal: Thanks! Also added tests. Any e-mail you want to have in your credits?

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

by niklasf at 2012-06-11T14:41:39Z

@stealth35: Yeah ... makes sense. How would I get that information?

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

by stealth35 at 2012-06-11T14:47:36Z

use the `Symfony\Component\HttpFoundation\File\Mimetype\MimeTypeExtensionGuesser` it's the same map as Apache
and if the extension don't exists use `$this->getMimeType` and finaly `application/octet-stream`

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

by Partugal at 2012-06-11T15:46:41Z

@niklasf Thanks you for your work
If needed you may use linniksa@gmail.com

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

by niklasf at 2012-06-14T10:58:19Z

@stealth35: Sorry. I have to ask again.
 - So the first step would be using the map in `MimeTypeExtensionGuesser`? I don't see how I can access that, because the `guess()` method it has, is for guessing extensions from mime types, not the reverse.
 - Then, by `$this->getMimeType` you mean the getMimeType() method of the file? Sounds good.
 - `application/octet-stream` as the fallback. Alright.

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

by stealth35 at 2012-06-14T11:00:33Z

Yeah sorry `MimeTypeExtensionGuesser` is for getting an extension with the Mime, forget about this, i'll take care aboute all MIME intégration later

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

by niklasf at 2012-06-14T13:12:22Z

@stealth35: Awesome. Thanks a lot.

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

by jalliot at 2012-08-07T20:53:54Z

@niklasf You should backport the changes from 532334d23d and 3f51bc0a3d

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

by niklasf at 2012-08-07T21:07:10Z

@jalliot Thanks. Fixed.
2012-10-29 11:57:31 +01:00
Fabien Potencier
0f5af869c8 merged branch jfsimon/issue-5851 (PR #5859)
This PR was merged into the master branch.

Commits
-------

2817a47 [Finder] Fixed filename containing space bug in gnu adapter.
9bf7cb0 [Finder] Added filename containing space to tests.

Discussion
----------

[Finder] Fixed filename containing space bug in gnu find adapter.

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes: #5851

`GNU find` adapter now uses `cut` instead of `awk`.
2012-10-29 09:27:03 +01:00
Fabien Potencier
ba1592568f merged branch pborreli/sun-typos (PR #5858)
This PR was merged into the master branch.

Commits
-------

a7ce6be Fixed typos

Discussion
----------

Fixed typos
2012-10-29 08:15:24 +01:00
Jean-François Simon
2817a47367 [Finder] Fixed filename containing space bug in gnu adapter. 2012-10-29 08:03:45 +01:00
Jean-François Simon
9bf7cb0941 [Finder] Added filename containing space to tests. 2012-10-29 07:51:09 +01:00
Pascal Borreli
a7ce6be3f8 Fixed typos 2012-10-28 23:25:34 +00:00
Fabien Potencier
9681973676 merged branch acasademont/tweak_userform_security_listener (PR #5824)
This PR was merged into the master branch.

Commits
-------

3e58893 [Security] Tweak UsernamePasswordFormAuthenticationListener

Discussion
----------

[Security] Tweak UsernamePasswordFormAuthenticationListener

Bug fix: no
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: [![Build Status](https://secure.travis-ci.org/acasademont/symfony.png)](http://travis-ci.org/acasademont/symfony)
Fixes the following tickets: -
Todo: -
License of the code: MIT
Documentation PR: -

Improvements:

- Do not check twice for the ```only_post``` condition. The condition in the ```attemptAuthentication``` method is useless as this method will never be called if the previous ```requiresAuthentication``` call returns false.
- If the expected request is ```only_post```, check only the POST variables for the username and password parameters. Otherwise, query params and attributes are checked before.
- Use POST instead of post for correctness
2012-10-28 10:19:54 +01:00
Fabien Potencier
1f1beb1ceb [Security] fixed tests when OpenSSL is not installed 2012-10-28 09:01:53 +01:00
Fabien Potencier
d21584ec68 merged branch fabpot/prng (PR #4763)
This PR was merged into the master branch.

Commits
-------

aecc9b1 fixed tests when OpenSsl is not enabled in PHP, renamed a missnamed test, added missing license doc blocks
ca567b5 fixed CS
5cdf696 added a SecureRandomInterface
234f725 rename String to StringUtils
5849855 moved the secure random dep for remember me as a constructor argument
248703f renamed Prng to SecureRandom
c0c8972 simplified the Prng code
e5dc7af moved the secure random class from JMSSecurityExtraBundle to Symfony (closes #3595)

Discussion
----------

[2.2][Security] Add a PRNG (closes #3595)

As per #3595, I have moved the secure random class from JMSSecurityExtraBundle to Symfony.

It has more impact than I expected ;)

As you will see, the implementation has been refactored a bit. The most notable change is that Doctrine support has been moved to the bridge with the addition of a proper Doctrine seed provider (Doctrine is not a special case anymore).

The Doctrine configuration has been moved to the DoctrineBundle: doctrine/DoctrineBundle#91

schmittjoh/JMSSecurityExtraBundle#65 removes the code that has been moved.

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

by Seldaek at 2012-07-05T13:26:01Z

I'm all for more security features, and both the String class & the Prng class for wrapping openssl make a lot of sense IMO, but I fail to see the use of the rest.

If we just want a seed to have a fallback in case openssl is missing, I'd rather have a secret in the config.yml than a million classes to store the same secret in the DB. Maybe I'm missing something though? /cc @schmittjoh

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

by schmittjoh at 2012-07-05T16:32:10Z

Having the configuration in different places (SecurityBundle & DoctrineBundle) feels a bit weird. I would prefer an approach similar to ACL, or the user provider/firewall section with factories. The latter being a bit more work to implement and the former potentially asking for complaints about too tight coupling to Doctrine.

Regarding testing, we probably need to move the disableOpenSsl method to the SecureRandom class in order to allow OpenSSL to be disabled for testing and we also need to change the byte generation algorithm to produce the same output for the same starting seed. I agree that it does not make sense to introduce an interface for SecureRandom as only the seed providers should be replaced.

As for the seed itself, it is constantly updated and does not stay the same as in the beginning. Thus, we need a provider that we can write to, and not only read from. I'm also not sure about using OpenSSL on Windows as I have read enough resources which claimed that the entropy on Windows is not always good (including OpenSSL docs). Always using the custom seed provider at least always ensured proper entropy even if OpenSSL's speed issues have been fixed in newer PHP versions.

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

by stof at 2012-07-05T16:44:24Z

@schmittjoh everything is in SecurityBundle now as it does not use a database anymore

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

by stof at 2012-07-05T16:44:59Z

and there is no seed provider anymore either

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

by schmittjoh at 2012-07-05T16:53:39Z

Not having a seed provider is not such a good idea, but having a file-based seed provider is.

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

by Seldaek at 2012-07-05T17:01:18Z

@schmittjoh why would you need to replace the seed provider? Don't you think that people serious about security to the point that they would want a stronger seed provider would enable openssl instead?

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

by stof at 2012-07-05T17:06:50Z

Well, what I meant is that there is no interchangeable provider anymore. The Prng class uses the file directly.

And btw, I think the Prng class should be mockable for tests, so it should either have an interface or not be final (I vote for adding an interface)

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

by jalliot at 2012-07-09T18:46:12Z

@fabpot @schmittjoh What about using more fallbacks for `openssl_random_pseudo_bytes` like in @Seldaek's post ["Unpredictable hashes for humans"](http://seld.be/notes/unpredictable-hashes-for-humans)?
Trying `mcrypt_create_iv` first might also be faster.

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

by Seldaek at 2012-07-10T08:52:46Z

@jalliot I think mcrypt should be after if you make it use /dev/urandom, not 100% sure but openssl is probably higher quality than urandom.

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

by schmittjoh at 2012-07-10T09:12:07Z

The fallback algorithm that I added should be enough (it passes the
statistical randomness tests).

On Tue, Jul 10, 2012 at 10:52 AM, Jordi Boggiano <
reply@reply.github.com
> wrote:

> @jalliot I think mcrypt should be after if you make it use /dev/urandom,
> not 100% sure but openssl is probably higher quality than urandom.
>
> ---
> Reply to this email directly or view it on GitHub:
> https://github.com/symfony/symfony/pull/4763#issuecomment-6870145
>

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

by stof at 2012-10-13T17:20:06Z

@fabpot please send a PR to the doc so that this can be merged 😃

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

by stof at 2012-10-13T17:22:08Z

hmm, actually, some comments have not been taken into account yet so it is not ready to be merged

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

by stof at 2012-10-27T07:14:43Z

you forgot the SecureRandom file

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

by fabpot at 2012-10-27T08:49:54Z

I think I've addressed all the comments. If everyone agree with the current implementation, I'm going to start updating the documentation.

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

by fabpot at 2012-10-27T10:51:15Z

I've fixed the remaining CS issues.

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

by fabpot at 2012-10-28T07:00:31Z

Documentation is here: symfony/symfony-docs#1858
2012-10-28 08:10:00 +01:00
Fabien Potencier
aecc9b12a3 fixed tests when OpenSsl is not enabled in PHP, renamed a missnamed test, added missing license doc blocks 2012-10-28 08:06:38 +01:00
Fabien Potencier
ca567b5109 fixed CS 2012-10-28 08:06:38 +01:00
Fabien Potencier
5cdf696bde added a SecureRandomInterface 2012-10-28 08:06:38 +01:00
Fabien Potencier
234f7255bb rename String to StringUtils 2012-10-28 08:06:37 +01:00
Fabien Potencier
5849855eb9 moved the secure random dep for remember me as a constructor argument 2012-10-28 08:06:37 +01:00
Fabien Potencier
248703f6d8 renamed Prng to SecureRandom 2012-10-28 08:06:33 +01:00
Fabien Potencier
c0c89724b0 simplified the Prng code 2012-10-28 08:03:05 +01:00
Fabien Potencier
e5dc7afe90 moved the secure random class from JMSSecurityExtraBundle to Symfony (closes #3595) 2012-10-28 08:03:00 +01:00
Fabien Potencier
eb05fb0a5f merged branch raziel057/patch-2 (PR #5847)
This PR was squashed before being merged into the master branch (closes #5847).

Commits
-------

00d2823 Improve comments in ProfilerController

Discussion
----------

Improve comments in ProfilerController

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

by raziel057 at 2012-10-27T21:55:17Z

It's fixed.
2012-10-28 07:05:50 +01:00
Thomas Lallement
00d282324c Improve comments in ProfilerController 2012-10-28 07:05:50 +01:00
Fabien Potencier
7ddedabdae [Propel1] fixed CHANGELOG 2012-10-27 21:41:12 +02:00
Fabien Potencier
107e1f1f6d merged branch kufi/master (PR #5032)
This PR was squashed before being merged into the master branch (closes #5032).

Commits
-------

afba15f [2.2] Translatable field type for Propel i18n columns

Discussion
----------

[2.2] Translatable field type for Propel i18n columns

A field type which allows to automatically generate the correct fields for propels i18n behavior.

Usage example:

     $builder->add('pageI18ns', 'translatable_collection', array(
            'i18n_class' => '\foo\barBundle\Model\PageI18n',
            'languages' => array('de', 'fr'),
            'label' => 'Translations',
            'columns' => array(
                'title' => array(
                    'label' => 'Custom title',
                ),
                'description' => array(
                    'type' => 'textarea'
                )
            )
        ));

With this configuration the field automatically generates the correct fields for the title and description column for the given languages.

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

by stof at 2012-07-24T14:37:27Z

tests are also missing

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

by kufi at 2012-07-27T08:50:05Z

Ok. Moved the Listeners into own classes. Changed the names of the types. Fixed the TranslationCollectionType which now is a Subclass of AbstractType and has the parent collection.

Edit:
The syntax changed slighty for the form:

    $builder->add('pageI18ns', new \Symfony\Bridge\Propel1\Form\Type\TranslationCollectionType(), array(
            'languages' => array('de', 'fr', 'en'),
            'label' => 'Translations',
            'options' => array(
                'data_class' => 'foo\bar\Modell\PageI18n',
                'columns' => array(
                    'title' => array(
                        'label' => 'Custom title',
                    ),
                    'description' => array(
                        'type' => 'textarea'
                    )
                )
            )
        ));

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

by stof at 2012-07-27T08:55:07Z

tests are still missing, and you have some CS issue (which can probably all be fixed by running the [PHP-CS-Fixer](http://cs.sensiolabs.org/) on your classes)

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

by sindro88 at 2012-08-13T13:27:46Z

I followed step by step the implementation but the form type return an error "Could not load type propel1_translation".

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

by kufi at 2012-08-14T06:21:40Z

Could you try again. The problem was that the type propel1_translation_collection relied on a registered form type propel1_translation. I removed this one and replaced it with the actual form class.

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

by sindro88 at 2012-08-14T06:35:33Z

I replaced with the class and now it work, thank you so much!

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

by fabpot at 2012-09-18T16:53:21Z

ping @willdurand

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

by stof at 2012-10-13T17:56:16Z

@willdurand ping

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

by willdurand at 2012-10-23T12:03:22Z

There are a few comments by @stloyd to fix, but I'm 👍 on this PR.

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

by fabpot at 2012-10-23T13:18:59Z

@kufi Can you add a note in the CHANGELOG of the Propel bridge before I merge this PR? Thanks.

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

by kufi at 2012-10-23T13:32:31Z

@fabpot Sure. Does this belong to Version 2.1.0 or the upcoming 2.2.0?

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

by fabpot at 2012-10-23T13:59:04Z

2.2
2012-10-27 21:40:56 +02:00
Patrick Kaufmann
afba15f263 [2.2] Translatable field type for Propel i18n columns 2012-10-27 21:40:54 +02:00
Fabien Potencier
4cefb62f0a updated CHANGELOG 2012-10-27 18:57:10 +02:00
Fabien Potencier
e44141162e merged branch merk/card-scheme-validator (PR #5072)
This PR was merged into the master branch.

Commits
-------

e2aa79b Added CardScheme validator

Discussion
----------

[2.2] [Validator] Added CardScheme validator

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

CardScheme separated into its own PR from #4734 as requested by @fabpot

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

by fabpot at 2012-10-05T17:08:24Z

As far I understand the discussion on #4734, a few people seemed to be concerned about the usefulness of adding such a validator in Symfony core. Anyone wanting to give his point of view? Personally, I'm -0 on merging this.

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

by merk at 2012-10-05T22:27:05Z

There are circumstances where such logic is required, and it could be desired by the programmer to filter out valid cards for a payment gateway before sending a request.

However, this is already included in JMSPaymentBundle if people don't think it should be in core.
2012-10-27 18:56:40 +02:00
Fabien Potencier
ef26a2185e [Process] added unit tests, phpdoc, and reorganized methods from previous merge 2012-10-27 18:54:34 +02:00
Fabien Potencier
41cb44bdac merged branch boombatower/process-status-5453 (PR #5455)
This PR was squashed before being merged into the master branch (closes #5455).

Commits
-------

7ea2f76 [process] expose the process status.

Discussion
----------

[process] expose the process status.

Pull request for issue #5453.

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

by pborreli at 2012-09-07T07:30:01Z

👍

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

by drak at 2012-09-21T18:53:14Z

This PR is missing the patch header in the description https://github.com/symfony/symfony-docs/blob/master/contributing/code/patches.rst#make-a-pull-request

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

by stof at 2012-10-13T21:25:04Z

@boombatower can you update the PR according to my comments and add some tests ?
2012-10-27 18:47:38 +02:00
boombatower
7ea2f76266 [process] expose the process status. 2012-10-27 18:47:38 +02:00
Fabien Potencier
d4c011d56d merged branch dirkaholic/master (PR #5638)
This PR was squashed before being merged into the master branch (closes #5638).

Commits
-------

98b68c2 [2.2][Console] Add possibility to add new input options to console application

Discussion
----------

[2.2][Console] Add possibility to add new input options to console application

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

At the moment it is not possible to overwrite the input arguments of a console application to not have the default ones. Adding is possible with:

$cli->getDefinition()->addOption(new InputOption('--custom', '-c', InputOption::VALUE_NONE, 'Use custom option.'));

Also added some simple tests for adding a custom HelperSet.

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

by dirkaholic at 2012-10-04T06:29:57Z

OK, is a bit inconsistent with what it's done with the helper set then, where you can use both ways. New PR for the tests is the referenced one.

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

by stof at 2012-10-04T18:57:42Z

@dirkaholic Can you rebase your branch (it conflicts with master) and squash your commit together ?

http://symfony.com/doc/current/contributing/code/patches.html#rework-your-patch may help you if you don't know how to do it

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

by dirkaholic at 2012-10-04T19:53:09Z

Done.

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

by stof at 2012-10-04T21:40:53Z

@dirkaholic the rebase worked fine but you have not squashed the commits together.

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

by dirkaholic at 2012-10-05T05:35:30Z

What do you mean ? Only the setDefinition function plus test is left here. The rest was already merged with https://github.com/symfony/symfony/issues/5668

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

by stof at 2012-10-05T10:48:53Z

@dirkaholic Squashing is about making the PR use only 1 commit instead of 2 (the second one changing only some whitespaces, which is not what its message says). But @fabpot told me that he improved his merging tool and so he can squash it when merging so it is OK.
2012-10-27 18:40:54 +02:00
Dirk Pahl
98b68c29ce [2.2][Console] Add possibility to add new input options to console application 2012-10-27 18:40:53 +02:00
Fabien Potencier
bdb5275da1 merged branch daum/master (PR #5601)
This PR was squashed before being merged into the master branch (closes #5601).

Commits
-------

7914d95 [HttpFoundation] UploadedFile: Added ability to the original extension of the file uploaded

Discussion
----------

[HttpFoundation] UploadedFile: Added ability to the original extension of the file uploaded

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

`$file->getExtension()` on uploaded files always will return blank as the temp file names do not have an extension. This adds `$file->getClientOriginalExtension()` which returns the extension based off the original file name. It also includes a test to check this function.

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

by daum at 2012-09-25T21:54:00Z

@stof just pushed updated doc block and spacing fix.

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

by stof at 2012-10-13T21:47:17Z

@fabpot anything missing to merge it ?
2012-10-27 18:37:40 +02:00
Matt Daum
7914d957f0 [HttpFoundation] UploadedFile: Added ability to the original extension of the file uploaded 2012-10-27 18:37:39 +02:00
Fabien Potencier
da1b635d87 merged branch msonnabaum/httpcache_store_locking_fixes (PR #5381)
This PR was squashed before being merged into the master branch (closes #5381).

Commits
-------

0f3126f Added lockExists to Store interface, fixed locking bugs, added tests.

Discussion
----------

Added lockExists to Store interface, fixed locking bugs, added tests.

While working on Drupal's HttpCache implementation, I discovered that the base HttpCache class does an is_file to check for a lock, which assumes a file-based cache is being used. This seems like a mistake since the rest of the Store interface is easily swappable. I added a lockExists method so that this is properly abstracted.

I also noticed there were no tests for the change I made, so I added some very basic locking tests. While adding those I found that the existing lock method is a bit broken. This line here:

```php
<?php

if (false !== $lock = @fopen($path = $this->getPath($this->getCacheKey($request).'.lck'), 'x')) {
```

will return false if the file couldn't be written for any reason, but the rest of the method assumes that if $lock == false, the lock exists already. So if the file couldnt be written due to the parent directory not existing, $path will be returned as if it exists, which is clearly not the desired behavior.

I changed this to return false if the file couldnt be written and doesn't exist, $path if it exists, and true if the lock was created. It still doesn't feel great to have bool|string return values, but that's the best I could come up with atm. I also added a check for the parent directory that creates it if it doesn't exist. The new tests fail without it.

I also broke out that code a bit as it was very difficult to read.

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

by henrikbjorn at 2012-08-30T09:11:16Z

Symfony have a editorconfig file which set the correct indentation settings. http://editorconfig.org/

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

by msonnabaum at 2012-08-30T13:00:20Z

Updated based on stof's feedback.

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

by msonnabaum at 2012-08-30T13:21:40Z

Fixed based on code style feedback.

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

by jonathaningram at 2012-09-05T12:29:47Z

@msonnabaum, this seems to be distantly related to my recent PR too: #5376.

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

by stof at 2012-10-13T20:35:55Z

@fabpot anything left to merge this ?

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

by catch56 at 2012-10-23T16:42:10Z

This looks great to me, Couldn't find anything to complain about.
2012-10-27 18:31:07 +02:00
Mark Sonnabaum
0f3126f397 Added lockExists to Store interface, fixed locking bugs, added tests. 2012-10-27 18:31:06 +02:00
Fabien Potencier
7b998d9b2d Merge branch '2.1'
* 2.1:
  [ClassLoader] fixed unbracketed namespaces (closes #5747)
  slight refactoring in UrlMatcher
  [Form] Created test for DoctrineOrmTypeGuesser see #5790
  [Form] Fixed DoctrineOrmTypeGuesser to guess the "required" option for to-one associations
2012-10-27 17:59:37 +02:00
Fabien Potencier
43aa20fcb6 Merge branch '2.0' into 2.1
* 2.0:
  [ClassLoader] fixed unbracketed namespaces (closes #5747)

Conflicts:
	src/Symfony/Component/ClassLoader/ClassCollectionLoader.php
	tests/Symfony/Tests/Component/ClassLoader/ClassCollectionLoaderTest.php
2012-10-27 17:59:21 +02:00
Fabien Potencier
6f15c4780f [ClassLoader] fixed unbracketed namespaces (closes #5747) 2012-10-27 17:55:46 +02:00
Fabien Potencier
7adee1aeb2 [ClassLoader] added some tests for previous merge 2012-10-27 17:07:38 +02:00
Fabien Potencier
537760f058 merged branch bamarni/classcollectionloader-globalnamespace (PR #5120)
This PR was merged into the master branch.

Commits
-------

adeadfb fixed comment striping on global namespace classes

Discussion
----------

[ClassCollectionLoader] fixed comment striping on global namespace classes

previously #4792, I've removed the multiple blank lines removal not to break heredocs.

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

by stof at 2012-10-13T18:04:56Z

@fabpot is there anything left to merge this ?

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

by bamarni at 2012-10-14T11:47:23Z

I've added a space when faking a namespace, so that it stils works without the tokenizer (if #5747 gets merged)
2012-10-27 17:04:59 +02:00
Fabien Potencier
d7a02b5433 [Process] fixed previous merge 2012-10-27 15:48:18 +02:00
Fabien Potencier
453ff1af76 [Process] updated the CHANGELOG 2012-10-27 15:46:00 +02:00
Fabien Potencier
a6b2aa714b merged branch romainneutron/ProcessIncrementalOutput (PR #5546)
This PR was merged into the master branch.

Commits
-------

b89e413 [Process] Add output / error output incremental getters

Discussion
----------

[2.2][Process] Add output / error output incremental getters

Bug fix: #4999
Feature addition: yes
Backwards compatibility break: no
Symfony2 tests pass: yes
License of the code: MIT

Travis fails ; tests are ok on my local clone but upstream symfony master is currently broken

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

by stof at 2012-10-13T21:20:47Z

@romainneutron is there anything left before merging ? And please open a PR to the documentation to document the new feature
2012-10-27 15:43:43 +02:00
Fabien Potencier
c7ef309e2a merged branch eventhorizonpl/100ptc_component_httpfundation_p10 (PR #5757)
This PR was merged into the master branch.

Commits
-------

85d39aa session class tests

Discussion
----------

session class tests

Hi,

This patch adds some Session class tests.

Best regards,
Michal

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

by lsmith77 at 2012-10-19T17:04:29Z

can you close and reopen this PR to retriggered the travis build?
2012-10-27 15:38:48 +02:00
Fabien Potencier
31db547a40 merged branch eventhorizonpl/100ptc_component_httpfundation_p9 (PR #5756)
This PR was merged into the master branch.

Commits
-------

99aa37c tests for Request class

Discussion
----------

tests for Request class

Hi,

This patch adds some tests for Request class.

Best regards,
Michal

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

by lsmith77 at 2012-10-19T17:04:33Z

can you close and reopen this PR to retriggered the travis build?
2012-10-27 15:38:10 +02:00
Fabien Potencier
e3ceb56b48 merged branch Burgov/doctrine_orm_type_guesser_tests (PR #5793)
This PR was merged into the 2.1 branch.

Commits
-------

5d2525b [Form] Created test for DoctrineOrmTypeGuesser see #5790
b844d6b [Form] Fixed DoctrineOrmTypeGuesser to guess the "required" option for to-one associations

Discussion
----------

[Form] Doctrine orm type guesser tests

This PR adds tests to https://github.com/symfony/symfony/pull/5790

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

by Tobion at 2012-10-20T10:53:56Z

Using real test entities would be better IMO. Using mocks ties it pretty much to the implementation.

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

by sstok at 2012-10-21T10:38:53Z

@Tobion thats true, but Doctrine Class meta data takes quite some coding to set-up.
For instance you need the EntityManager to get even get the meta data set!

So you'd end having more code to set-up then your actually testing.

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

by Burgov at 2012-10-21T12:58:58Z

I wasn't sure whether do use a test entity manager, or do it the way I finally did it.

@sstok true, it's quite some work to set it up, but on the other hand there's the base OrmTestCase class which does it for you, so it'd actually mean I'd only have to create one entity for all the cases: https://github.com/symfony/symfony/blob/master/src/Symfony/Bridge/Doctrine/Tests/DoctrineOrmTestCase.php

@Tobion on the other hand I tend to use a test EM only when I actually need to test persisting and loading, while this test case here is so isolated that I didn't really feel it would be necessary.

I'd like to know which method is preferred though, I'll change it if necessary, and other tests can be added to test the rest of this specific class
2012-10-27 15:36:11 +02:00
Fabien Potencier
15731a982e merged branch jfcixmedia/2.1 (PR #5838)
This PR was squashed before being merged into the master branch (closes #5838).

Commits
-------

201f3e6 [Form] Fixed cannot unset string offsets in CsrfValidationListener

Discussion
----------

[Form] Fixed cannot unset string offsets in CsrfValidationListener

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

A php fatal error is happening when someone rewrite the entire form data for an object with a single input.
```
Fatal error: Cannot unset string offsets in vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Csrf/EventListener/CsrfValidationListener.php on line 72
```

Example:

```html
<form action="/app_dev.php/post/create" method="post" >
    <div id="posttype">
        <div>
            <label for="posttype_name" class="required">Name</label>
            <input type="text" id="posttype_name" name="posttype[name]" required="required" maxlength="255" />
        </div>
        <div>
            <label for="posttype_text" class="required">Text</label>
            <textarea id="posttype_text" name="posttype[text]" required="required"></textarea>
        </div>
        <input type="hidden" id="posttype__token" name="posttype[_token]" value="83a1617c694fbdea43c2527f1a55c7419ce82a42" /></div>
        <p>
            <button type="submit">Create</button>
        </p>
</form>
```

If someone alters the html to add a simple input at the bottom of the form like this one:
```html
<input type="text" id="posttype" name="posttype" value="test123" />
```

The result will be a php fatal error.

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

by bschussek at 2012-10-26T09:49:05Z

Thank you for the pull request! Could you please reference the pull request in the test?

```php
// https://github.com/symfony/symfony/pull/5838
public function testStringFormData()
{
    ...
```

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

by jfcixmedia at 2012-10-26T10:21:29Z

@bschussek  Added, thanks.
2012-10-27 15:29:28 +02:00
jfcixmedia
201f3e6489 [Form] Fixed cannot unset string offsets in CsrfValidationListener 2012-10-27 15:29:27 +02:00