Commit Graph

8796 Commits

Author SHA1 Message Date
Fabien Potencier
d872ad54fa 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.
2012-03-22 14:07:25 +01:00
Fabien Potencier
26c9cb787e 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 :-)
2012-03-22 00:10:35 +01:00
Fabien Potencier
2c133e6891 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: -
2012-03-22 00:06:33 +01:00
Fabien Potencier
8976a05389 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.
2012-03-22 00:06:17 +01:00
Florin Patan
a1d8ff8fc7 [FrameworkBundle] Updated translations for #3637 2012-03-22 00:46:10 +02:00
Hugo Hamon
00ae7662bf [FrameworkBundle] added new french validators translations for the File constraint. 2012-03-21 22:48:07 +01:00
Toni Uebernickel
4a43453db8 remove callback from constructor and create method 2012-03-21 22:40:39 +01:00
Fabien Potencier
72b9793940 fixed previous merge 2012-03-21 22:35:06 +01:00
Fabien Potencier
0ad71a07e8 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?
2012-03-21 22:31:15 +01:00
Fabien Potencier
e83f5f4f03 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.
2012-03-21 22:27:33 +01:00
Fabien Potencier
2254531d8d merged branch bamarni/master (PR #3670)
Commits
-------

3638c72 unused variable removed

Discussion
----------

[FrameworkBundle] unused variable removed
2012-03-21 22:24:46 +01:00
Bilal Amarni
3638c72fe5 unused variable removed 2012-03-21 22:15:47 +01:00
Fabien Potencier
9cdc9712b0 merged branch vicb/form/guess/length (PR #3645)
Commits
-------

fc7c7f6 [Form] Fix min/max length guessing for numeric types (fix #3091)

Discussion
----------

[Form] Fix min/max length guessing for numeric types (fix #3091)

Before this PR, the length was guessed from `strlen(min/max)`.

This is obviously false for float: `strlen("1.123") > strlen ("5")` then this guess is now low confidence only and is masked by a `null` medium confidence guess for floats (implemented in both doctrine ORM & validator).

This PR also includes some code reorg in order to improve readability.

I'll update Propel & Mongo if needed once this is merged.

_note: `5.000` did neither work because of `5e3`_

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

by Koc at 2012-03-19T23:42:01Z

Will `strlen` works correctly with multibyte strings?

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

by vicb at 2012-03-19T23:58:33Z

could numeric types be multibyte strings ?

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

by Koc at 2012-03-20T00:07:24Z

I thought it somehow concerns `Symfony\Component\Validator\Constraints\MaxLengthValidator` too.

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

by vicb at 2012-03-20T00:20:33Z

This PR is about numeric types only and the MaxLengthValidator is [multibyte safe:](https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Validator/Constraints/MaxLengthValidator.php#L45)
2012-03-21 18:41:37 +01:00
Fabien Potencier
ee9c986790 merged branch Tobion/command-name (PR #3285)
Commits
-------

447d468 restore previous testing style with static fixtures for console
11585c3 fix Command:asXml to use processed help
304e13d replaced command names with supported placeholders in help texts

Discussion
----------

using the placeholder in command help texts

Replaced the command names with the already supported placeholders `%command.name%` and `%command.full_name%`. Thus preventing typos in future commands based on the existing ones.

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

by fabpot at 2012-02-09T06:26:07Z

That breaks the unit tests.

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

by Tobion at 2012-02-09T17:05:06Z

fixed

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

by stof at 2012-02-09T17:43:47Z

can you rebase your branch please ? it conflicts with master

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

by stof at 2012-02-09T17:44:11Z

the reason is simple: SwiftmailerBundle is gone :)

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

by Tobion at 2012-02-09T23:23:23Z

done

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

by fabpot at 2012-02-11T23:47:10Z

Can you squash your commit before I merge this PR? Thanks.

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

by Tobion at 2012-02-12T13:57:14Z

I'm unable to squash it into 1 commit because of the uptream commits inside.
I hope it's fine now. If not someone needs to help me.

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

by stof at 2012-02-12T14:27:38Z

``git rebase -i upstream/master`` should allow you rebasing things and squashing them toghter (changing the action for the second commit to ``squash``)

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

by Tobion at 2012-02-12T14:47:29Z

first i tried with git rebase -i head~4 (4 commits), but this showed many more external commits. second I tried git reset --soft with a clean commit, but still no success.
then I used your proposal. and there are always conflicts of stuff that is not part of my PR.
now the diff is messed up...
this is frustrating

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

by stof at 2012-02-12T14:58:43Z

The only reason why the diff is messed is because you messed it when resolving the conflicts by choosing the wrong result for the output. Please fix things as it means that merging your PR would revert changes done previosuly

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

by stof at 2012-02-12T15:00:18Z

Basically, you reverted most of the changes done in Symfony the few last days.

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

by Tobion at 2012-02-12T15:10:59Z

I used `git checkout --theirs .` when resolving. Whats the correct way?

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

by stof at 2012-02-12T15:13:21Z

Well, I generally resolve the conflicts myself instead of asking git to use one version, as generally the final code is not one of the versions by a mix of both versions (as both sides are likely to have done useful changes)

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

by Tobion at 2012-02-12T15:15:02Z

Yes but the conflicts are in files I never touched and that are not part of my changes.
I cannot resolve hundreds of files by hand.

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

by Tobion at 2012-02-12T15:41:31Z

Finally it worked. I used git reset head~1 and then discarded all foreign changes.
There you go.

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

by Tobion at 2012-02-14T14:06:04Z

@fabpot ping

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

by Tobion at 2012-02-20T18:20:50Z

@fabpot ping

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

by stof at 2012-03-02T22:14:49Z

@Tobion the branch needs to be rebased. It conflicts with master

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

by Tobion at 2012-03-21T04:22:10Z

All done. I don't want to squash commits because they are self-contained fixes and changes that might be needed for future references (like the dynamic tests for -`>run()`).
2012-03-21 18:31:29 +01:00
Julien Brochet
93d2a4f039 [Translation] Ignore xliff entries with no "target" node 2012-03-21 14:55:53 +01:00
Tobias Schultze
447d46814c restore previous testing style with static fixtures for console 2012-03-21 05:32:53 +01:00
Tobias Schultze
11585c3b67 fix Command:asXml to use processed help 2012-03-21 05:32:51 +01:00
Tobias Schultze
304e13daa3 replaced command names with supported placeholders in help texts 2012-03-21 05:31:52 +01:00
Fabien Potencier
69fc07a21c merged branch vicb/routing_cleanup (PR #3647)
Commits
-------

a8e17fe [Routing] Cleanup

Discussion
----------

[Routing] Cleanup

removing the obsolete `segment_separators` option
2012-03-21 00:33:54 +01:00
Fabien Potencier
b5c5212163 merged branch vicb/profiler/mongo/fix (PR #3650)
Commits
-------

979c02b [HttpKernel] Fix MongoDbProfilerStorageTest

Discussion
----------

[HttpKernel] Fix MongoDbProfilerStorageTest

* The test was failing if no connection (trying to call purge)
* The extension / connection was tested before each single test
2012-03-21 00:33:17 +01:00
Fabien Potencier
1d4ccef0bb merged branch dlsniper/update-validators (PR #3656)
Commits
-------

a09deca [Validator] Updated Romanian translation

Discussion
----------

[Validator] Updated Romanian translation

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

Updated to use the latest strings.
2012-03-21 00:13:55 +01:00
Florin Patan
a09deca5da [Validator] Updated Romanian translation 2012-03-21 00:50:04 +02:00
Victor Berchet
979c02ba1f [HttpKernel] Fix MongoDbProfilerStorageTest 2012-03-20 17:56:45 +01:00
Toni Uebernickel
601b87ca01 add basic validation of callback name 2012-03-20 11:05:22 +01:00
Toni Uebernickel
266f76d963 rename jsonp to callback, defaults to null 2012-03-20 10:10:35 +01:00
Victor Berchet
a8e17fe45b [Routing] Cleanup 2012-03-20 09:12:35 +01:00
Victor Berchet
fc7c7f6458 [Form] Fix min/max length guessing for numeric types (fix #3091) 2012-03-19 23:57:21 +01:00
Rafael Dohms
836d12b660 Fixing typo. 2012-03-19 23:29:43 +01:00
Fabien Potencier
ffddddb3ea merged branch aubx/croatian-validators-translation (PR #3641)
Commits
-------

e95ef75 Added Croatian translation of validator

Discussion
----------

Added Croatian translation of validator

My first PR :)
2012-03-19 22:51:20 +01:00
aubx
e95ef75015 Added Croatian translation of validator 2012-03-19 20:37:53 +01:00
Toni Uebernickel
38b79a7023 add data and callback setter to JsonResponse 2012-03-19 19:40:54 +01:00
Toni Uebernickel
678822459b add JSONP support to JsonResponse 2012-03-19 18:29:39 +01:00
Fabien Potencier
05c523a7de removed obsolete phpdoc 2012-03-19 16:13:52 +01:00
Rafael Dohms
ac2a187b4d 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.
2012-03-19 14:37:25 +01:00
Fabien Potencier
edac48a824 merged branch blahy/code-coverage-fix (PR #3617)
Commits
-------

9ed7c03 fixed code coverage raport generation

Discussion
----------

fixed code coverage raport generation

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: no (tests were already broken)
Fixes the following tickets: -
Todo: -

I wanted to run the test coverage for Symfony2.1.
I installed vendors using composer but code coverage script failed (running unit tests failed too).
After installing vendors using vendors.php I got errors about missing classes:
`Class 'Doctrine\Common\DataFixtures\Loader' not found`
and later: `Class 'Monolog\Handler\ChromePHPHandler' not found.`

The changes made it possible to run the code coverage script.
Monolog was already present in autoload.php.dist but was not present in vendors.php script, doctrine fixtures were not included in both.
2012-03-19 00:30:56 +01:00
Fabien Potencier
645d09c984 merged branch jmikola/double-dash (PR #3624)
Commits
-------

4d4ef24 [Console] Stop parsing options after encountering "--" token

Discussion
----------

[Console] Stop parsing options after encountering "--" token

This enables support for arguments with leading dashes (e.g. "-1"), as supported by getopt in other languages.

[![Build Status](https://secure.travis-ci.org/jmikola/symfony.png?branch=double-dash)](http://travis-ci.org/jmikola/symfony)

The test suite currently fails due to 7a54fe41ca. ArgvInputTest passes, and these changes don't appear to break anything else.

![](http://media.giantbomb.com/uploads/2/27528/1061704-mario_kart_double_dash___title_screen_super.jpg)

Aside: This got me thinking about how one would pass an option value of "-1". I suppose for input options with `VALUE_OPTIONAL`, it would be ambiguous if "-1" followed; however, `VALUE_REQUIRED` should probably require that the next token is captured as the option value. In my tests, a required option value with a leading dash was interpreted as another option. The workaround for all of this is to use the space-less syntax (e.g. `-f=-1`).

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

by fabpot at 2012-03-17T08:43:15Z

AFAIK, the `--` should disable both option and argument parsing, no?

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

by jmikola at 2012-03-18T02:13:51Z

If that were the case, what would be the point of using `--` at all? :)

 * http://wiki.bash-hackers.org/dict/terms/end_of_options
 * http://perldoc.perl.org/Getopt/Long.html#Mixing-command-line-option-with-other-arguments
2012-03-19 00:28:49 +01:00
Jordi Boggiano
da3a2c4749 [Process] Fix command escaping 2012-03-18 13:07:34 +01:00
Fabien Potencier
3d84153d68 merged branch pulzarraider/session_doc_fix (PR #3627)
Commits
-------

f351cdc doc fix

Discussion
----------

[HttpFoundation] documentation fix

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: -
Todo: -
2012-03-17 09:40:25 +01:00
Andrej Hudec
f351cdc52c doc fix 2012-03-17 00:59:57 +01:00
Victor Berchet
99406eb761 Update src/Symfony/Component/Validator/Mapping/ClassMetadataFactory.php 2012-03-16 23:38:13 +01:00
Jeremy Mikola
4d4ef24c47 [Console] Stop parsing options after encountering "--" token
This enables support for arguments with leading dashes (e.g. "-1"), as supported by getopt in other languages.
2012-03-16 15:53:13 -04:00
Piotr Błasiak
9ed7c03d6c fixed code coverage raport generation 2012-03-16 15:28:27 +01:00
Fabien Potencier
91e977d38c fixed CS for previous merge 2012-03-16 13:29:17 +01:00
Fabien Potencier
7c6b288ca2 merged branch rdohms/patch-3 (PR #3614)
Commits
-------

2c4a43d Made option to use symlink explicit in the output. This can clear up any issues for example when running composer update to know if assets:install did a symlink or hard copy.

Discussion
----------

Made assets:install output copy mode its using

Made option to use symlink explicit in the output. This can clear up any issues for example when running composer update to know if assets:install did a symlink or hard copy.

On a general it just makes communication a bit clearer on what is being executed.

Further improvement is to make Composer install use the same process as was previously used on that server.
2012-03-16 13:28:36 +01:00
Rafael Dohms
2c4a43d91d Made option to use symlink explicit in the output. This can clear up any issues for example when running composer update to know if assets:install did a symlink or hard copy.
On a general it just makes communication a bit clearer on what is being executed.
2012-03-16 12:37:18 +01:00
Fabien Potencier
5631002cd0 merged branch Seldaek/chainableresp (PR #3606)
Commits
-------

3297f75 Fix header override
076bd1e [HttpFoundation] Add create on StreamedResponse

Discussion
----------

Chainable response

Fixed feedback from #3605
2012-03-15 19:10:35 +01:00
Jordi Boggiano
3297f7548f Fix header override 2012-03-15 18:41:23 +01:00
Jordi Boggiano
076bd1e99f [HttpFoundation] Add create on StreamedResponse 2012-03-15 18:40:15 +01:00
Fabien Potencier
0ba5096fe6 fixed CS 2012-03-15 17:42:47 +01:00
Fabien Potencier
4c5c7bc91e merged branch Seldaek/chainableresp (PR #3605)
Commits
-------

ff13528 [HttpFoundation] Add create method to Json & Redirect responses
1c86ad7 [HttpFoundation] Add headers arg to RedirectResponse
873da43 [HttpFoundation] Add chainability to the Response class

Discussion
----------

Chainable responses

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

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

by cboden at 2012-03-15T15:53:43Z

+1
2012-03-15 17:39:12 +01:00