Commit Graph

8868 Commits

Author SHA1 Message Date
Lukas Kahwe Smith 72bf93f1d9 typo fix in upgrading guide 2012-03-25 18:27:20 -03:00
Fabien Potencier a00ae273a6 fixed previous commit 2012-03-24 00:31:38 +01:00
Fabien Potencier c4dfe931f1 [HttpFoundation] made the host lowercase as per RFC 952/2181 2012-03-23 20:09:44 +01:00
Fabien Potencier d5090ee044 merged branch schmittjoh/processFailedException (PR #3633)
Commits
-------

57de69f added an exception for failed processes

Discussion
----------

added an exception for failed processes

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

by Seldaek at 2012-03-19T07:27:56Z

So this is just there to use if you want to throw an exception when a process call failed in your application? It doesn't seem enabled by default, which I think is good anyway.

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

by stof at 2012-03-19T07:44:43Z

@Seldaek yeah, I guess this is a way to make it easier to reuse what he implemented for Assetic first.

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

by fabpot at 2012-03-23T15:08:26Z

How and when do you use such an exception?

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

by schmittjoh at 2012-03-23T17:22:16Z

It's intended for your own code to give you a nice and meaningful error message without having to repeat the same code whereever you are dealing with a Process:

```php
if (0 !== $proc->run()) {
    throw new ProcessFailedException($proc);
}
2012-03-23 19:56:05 +01:00
Fabien Potencier 5041f85878 tweaked UPGRADE file 2012-03-23 18:01:12 +01:00
Fabien Potencier afdecaf542 [HttpFoundation] fixed a test 2012-03-23 18:01:05 +01:00
Fabien Potencier 09ab6430c0 merged branch drak/session_flashmessages (PR #3267)
Commits
-------

5ae76f1 [HttpFoundation] Update documentation.
910b5c7 [HttpFoudation] CS, more tests and some optimization.
b0466e8 [HttpFoundation] Refactored BC Session class methods.
84c2e3c [HttpFoundation] Allow flash messages to have multiple messages per type.

Discussion
----------

[2.1][HttpFoundation] Multiple session flash messages

Bug fix: no
Feature addition: yes
Backwards compatibility break: yes, but this already happened in #2583.  BC `Session` methods remain unbroken.
Symfony2 tests pass: yes
Fixes the following tickets: #1863
References the following tickets: #2714, #2753, #2510, #2543, #2853
Todo: -

This PR alters flash messages so that it is possible to store more than one message per flash type using the `add()` method or by passing an array of messages to `set()`.

__NOTES ABOUT BC__

This PR maintains BC behaviour with the `Session` class in that the old Symfony 2.0 methods will continue to work as before.

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

by drak at 2012-02-13T06:28:33Z

I think this is ready for review @fabpot @lsmith77

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

by lsmith77 at 2012-02-14T19:30:39Z

the FlashBag vs. AutoExpireFlashBag behavior and setup difference should probably also be explained in the upgrading log

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

by drak at 2012-02-15T04:43:14Z

@lsmith77 Those differences are explained already in the changelog

 * Added `FlashBag`. Flashes expire when retrieved by `get()` or `all()`.
   This makes the implementation ESI compatible.
 * Added `AutoExpireFlashBag` (default) to replicate Symfony 2.0.x auto expire behaviour of messages auto expiring
   after one page page load.  Messages must be retrived by `get()` or `all()`.

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

by Crell at 2012-02-19T17:35:34Z

Drak asked me to weigh in here with use cases.  Drupal currently has a similar session-stored-messaging system in place that I'd like to be able to replace with Flash messages.  We frequently have multiple messages within a single request, however, so this change is critical to our being able to do so.

For instance, when saving an article in Drupal there is, by default, a "yay, you saved an article!" type message that gets displayed.  If you also have the site configured to send email when a post is updated, you may see a "email notifications sent" message (depending on your access level).  If you have a Solr server setup for search, and you're in debug mode, there will also be a "record ID X added to Solr, it should update in 2 minutes" message.  And if there's a bug somewhere, you'll also get, as an error message rather than notice message, a "Oops, E_NOTICE on line 54" message.

Form validation is another case.  If you have multiple errors in a single form, we prefer to list all of them.  So if you screw up 4 times on a form, you may get 4 different error messages showing what you screwed up so you can fix it in one go instead of several.

Now sure, one could emulate that by building a multi-message layer on top of single-layer messages, but, really, why?  "One is a special case of many", and there are many many cases where you'll want to post multiple messages.  Like, most of Drupal. :-)

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

by lsmith77 at 2012-03-06T20:55:51Z

@fabpot is there any information you still need before merging this? do you want more discussion in which case you might want to take this to the mailing list ..

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

by drak at 2012-03-08T18:54:13Z

Another plus for this PR is that it requires no extra lines of code in templates etc to display the flashes, see https://github.com/symfony/symfony/pull/3267/files#diff-1

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

by drak at 2012-03-15T06:38:21Z

Rebased against current `master`, should be mergeable again..

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

by evillemez at 2012-03-17T03:08:41Z

+1 to this, I have an extended version of HttpFoundation just for this... would love to get rid of it.
2012-03-23 17:58:09 +01:00
Fabien Potencier a597453fb3 merged branch schmittjoh/configurableExtension (PR #3632)
Commits
-------

3f2b917 added a configurable extension base class

Discussion
----------

added a configurable extension base class

This is mostly a convenience class which provides first-class integration with the Config/Definition component.
2012-03-23 16:03:48 +01:00
Fabien Potencier 6868e5177b merged branch nervo/patch-1 (PR #3684)
Commits
-------

09054f7 [Validator] Fix switch breaking in max/min length for constraint guesser, when a "Symfony\Component\Validator\Constraints\Type" constraint type is not in numeric types array

Discussion
----------

[Validator] Fix form type guesser

[Validator] Fix switch breaking in max/min length for constraint guesser, when a "Symfony\Component\Validator\Constraints\Type" constraint type is not in numeric types array

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

by vicb at 2012-03-23T14:19:27Z

You're right, thanks for the fix (I did break it !)
2012-03-23 15:43:59 +01:00
nervo 09054f7c9c [Validator] Fix switch breaking in max/min length for constraint guesser, when a "Symfony\Component\Validator\Constraints\Type" constraint type is not in numeric types array 2012-03-23 15:06:13 +01:00
Fabien Potencier e1362c6697 [FrameworkBundle] made log output optional depending on the verbose flag 2012-03-23 14:17:57 +01:00
Fabien Potencier 30cd43c68a fixed CS 2012-03-23 14:14:07 +01:00
Fabien Potencier 9d77078d3d merged branch michal-pipa/server (PR #3465)
Commits
-------

df11e62 [FrameworkBundle] Used $output->write() instead of echo
c3bf479 [FrameworkBundle] Used Process component
cfa2dff [FrameworkBundle] Changed server:run command description
e7d38c1 [FrameworkBundle] Changed PHP version detection (see: #3529)
4a3f6d5 [FrameworkBundle] Removed global variable from router script
519d431 [FrameworkBundle] Fixed built-in server router script
d9a0a17 [FrameworkBundle] Added server:run command

Discussion
----------

[FrameworkBundle] Added server:run command (PHP 5.4 built-in web server)

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

PHP 5.4 comes with [built-in web server](http://www.php.net/manual/en/features.commandline.webserver.php). I've created command which allows to easily run Symfony2 application using this new feature.

    Usage:
     server:run [-d|--docroot="..."] [-r|--router="..."] [address]

    Arguments:
     address        Address:port (default: 'localhost:8000')

    Options:
     --docroot (-d) Document root (default: 'web/')
     --router (-r)  Path to custom router script

    Help:
     The server:run runs Symfony2 application using PHP built-in web server:

       app/console server:run

     To change default bind address and port use the address argument:

       app/console server:run 127.0.0.1:8080

     To change default docroot directory use the --docroot option:

       app/console server:run --docroot=htdocs/

     If you have custom docroot directory layout, you can specify your own
     router script using --router option:

       app/console server:run --router=app/config/router.php

     See also: http://www.php.net/manual/en/features.commandline.webserver.php

It requires PHP 5.4, otherwise this command will be disabled.

I think that this is very convenient (especially for new users). All you have to do is download Symfony, install vendors and run this command. You don't have to configure "real" web server, in fact any other server is not required. You don't have cache and logs permission problem, because server runs with your local user permissions.

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

by blogsh at 2012-03-06T17:38:10Z

Great feature! I was about to write something like this when I saw that you have already started implementing this :)

Some issues:
1. Missing newlines at the end of the files
2. If I try this server command with the default Symfony Standard Edition Acme demo the links on the main page do not work. The demo link links to "//demo" and the configurator link to "//_configurator". If I go to `localhost:8000/demo` directly the page is rendered as usual and all sub links are generated correctly. I could solve the problem by adding one line:

    $_SERVER['SCRIPT_FILENAME'] = 'ANYTHING';
    require 'app_dev.php';

I'm not sure where this problem comes from. Do you experience the same behaviour? Otherwise I'll do some more investigations to find the source of the problem.

3 . I think it would be a nice feature if you would generate a router.php based on the setting of the --env flag if no custom router file has been specified. This way it would be easy to switch between dev and prod.

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

by michal-pipa at 2012-03-06T19:00:24Z

@blogsh

> Missing newlines at the end of the files

I've checked and I can see newlines at the end of files. Are you sure about this?

> If I try this server command with the default Symfony Standard Edition Acme demo the links on the main page do not work. The demo link links to "//demo" and the configurator link to "//_configurator". If I go to localhost:8000/demo directly the page is rendered as usual and all sub links are generated correctly. I could solve the problem by adding one line:
>
>     $_SERVER['SCRIPT_FILENAME'] = 'ANYTHING';
>     require 'app_dev.php';
>
> I'm not sure where this problem comes from. Do you experience the same behaviour? Otherwise I'll do some more investigations to find the source of the problem.

I can reproduce this by changing front controller name from  `app.php` to `app_dev.php`. I'll investigate on this.

> I think it would be a nice feature if you would generate a router.php based on the setting of the --env flag if no custom router file has been specified. This way it would be easy to switch between dev and prod.

You can easily change environment specifying front controller in URL. It works exactly the same way as default Apache configuration. This is intended behavior, as it would be misleading if every server had different rewrite rules.

If you really want to change it, then you can write your own router and pass it as a value to `router` option.

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

by blogsh at 2012-03-06T19:13:55Z

Wasn't aware that github omits the trailing white line, sorry.
Normally I use a rather inflexible nginx configuration, so I also wasn't aware of this (rather obvious) trick of changing the url. Thanks for that.

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

by stof at 2012-03-06T22:12:16Z

@blogsh it does not omit it. It displays it in the Linux way where the newline char is part of the line (and so there is a message ``no newline at end of file`` in the diff when it is missing).

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

by michal-pipa at 2012-03-07T07:18:23Z

@blogsh I've fixed router script. Now you can use both front controllers.

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

by michal-pipa at 2012-03-07T07:34:58Z

I've also hardcoded front controller name in router script and removed global variable, as there was no way to unset it.

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

by michal-pipa at 2012-03-13T07:57:04Z

I've used Process component, but now I don't get any stdout output (only stderr).

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

by michal-pipa at 2012-03-13T18:01:58Z

I've replaced `echo` by `$output->write()` and removed `$process` as it was not used actually.
2012-03-23 13:56:46 +01:00
Fabien Potencier 3deccc5ec8 [HttpFoundation] fixed phpdoc 2012-03-23 13:49:00 +01:00
Fabien Potencier 6381dbb8ed merged branch cboden/interfaces (PR #3520)
Commits
-------

bd02554 [HttpFoundation] SPL IteratorAggregate+Countable on *Bags
665fdeb [HttpFoundation] SPL on ParameterBag

Discussion
----------

[HttpFoundation] SPL on ParameterBag

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

Added a couple SPL interfaces to ParameterBag, added shortcuts to working with the parameters.  For example:

```php
<?php
    $post = Request::createFromGlobal()->request;
    echo "There are {count($post)} POST variables\n";

    foreach ($post as $key => $val) {
        echo "{$key}: {$val}\n";
    }
```

Thoughts?

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

by stealth35 at 2012-03-07T13:09:11Z

You already have the `all` method

``` php
<?php
$post = Request::createFromGlobals()->request->all();

echo "There are ", count($post), " POST variables\n";

foreach ($post as $key => $val) {
    echo "{$key}: {$val}\n";
}
```

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

by cboden at 2012-03-07T13:50:22Z

Yes, but when in the context of working with the Request object (or POST ParamegerBag), it's 1 more call and loose variable to set.

ParameterBag is a container, these common SPL interfaces give standard PHP container methods to it.

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

by lsmith77 at 2012-03-07T18:42:41Z

makes sense to me ..

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

by vicb at 2012-03-09T15:45:40Z

Probably makes sense. Could you check if any other `*Bag.php` needs to be updated so that it could ba an atomic merge.

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

by cboden at 2012-03-09T15:48:40Z

Whoops, good catch @vicb.  I made a poor assumption all the *Bags extended ParameterBag, while only some do.  I will post an update shortly.
2012-03-23 13:44:35 +01:00
Fabien Potencier 14a83ce064 merged branch pulzarraider/redis_session_storage (PR #3498)
Commits
-------

c4ee947 Native Redis Session Storage update
665f593 NativeRedisSessionStorage added

Discussion
----------

[HttpFoundation] Native Redis Session Storage

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

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

by lstrojny at 2012-03-04T23:15:43Z

Does Symfony (or any of its dependencies) has Redis support in any form whatsoever? If not this might be a good point to decide which clients to support

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

by lsmith77 at 2012-03-04T23:36:11Z

well ideally we just get this cache interface stuff done .. for this use case it would be perfect.

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

by pulzarraider at 2012-03-05T00:35:59Z

There is RedisProfilerStorage available (based on phpredis). I prefer and write code for [phpredis](https://github.com/nicolasff/phpredis).

It's recommended by [official Redis homepage](http://redis.io/clients#PHP). [In this benchmark](http://dev.af83.com/2011/01/01/which-php-library-to-use-with-redis-the-benchmark.html
) is fastest and less memory consumpting.

But if somebody prefer predis (with phpiredis), rediska or something other widely used, there are no limitations to add support of it to Symfony.

My opinion is, that the C extension should be supported at first, because of good performance and native session storage support. Redis is quite young and the process of creating PHP clients is comparable to Memcache.
There were created pure PHP Memcache clients in the past (Google found for example [this](http://www.phpclasses.org/browse/file/20284.html) and [this](http://code.blitzaffe.com/pages/phpclasses/files/memcached_client_52-12)), but they are not being used now. Everyone, who is seriously thinking about performance, is using only the C Redis/Memcache(d)/... extensions.

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

by drak at 2012-03-05T07:40:06Z

+1 on this PR.  Needs a test written though.
I don't think there is any need to wait for #3493 imo.  I'll deal with it if this is merged before #3493.
Are there any PHP ini settings for this for this driver or is everything via the `session.save_path` directive? (A quick look at the C code seems to indicate there are no explicit ini directives).

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

by lstrojny at 2012-03-05T12:14:34Z

@pulzarraider I don’t necessarily disagree with the usage of phpredis, I just wanted to bring up the issues of various clients and people having different preferences about them.

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

by fabpot at 2012-03-05T14:46:22Z

@pulzarraider Can you add some unit tests before I merge?

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

by pulzarraider at 2012-03-11T20:19:57Z

@drak No there are no php.ini settings. Only RedisArray has some, but it's another feature.

@fabpot I've added simple test based on other session storage tests.

I planned to create a RedisSessionStorage, too, but I have no time for it now. This can be added later in another PR as it's independent from NativeRedisSessionStorage.

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

by drak at 2012-03-12T02:21:25Z

The code looks OK to me.

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

by fabpot at 2012-03-15T06:05:27Z

#3493 has been merged now.

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

by pulzarraider at 2012-03-16T23:21:27Z

Code updated.
2012-03-23 13:42:58 +01:00
Fabien Potencier 14dd1a91a9 [Routing] made AnnotationDirectoryLoader deterministic (closes #3683) 2012-03-23 13:42:06 +01:00
Fabien Potencier e28223773c merged branch lencioni/improve-exception-controller-documentation (PR #3669)
Commits
-------

1422133 [TwigBundle] Made docblock for findTemplate() more general and accurate
5910ac9 [TwigBundle] Added a use statement to shorten class name in a docblock
3e7eebd [TwigBundle] Improved ExceptionController docblocks

Discussion
----------

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

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

by lencioni at 2012-03-21T20:47:16Z

I obviously don't know what I'm doing here. :/

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

by vicb at 2012-03-21T20:47:39Z

no pb just rebase on master and force push
2012-03-23 13:08:26 +01:00
Fabien Potencier 8c2f4fdb49 merged branch Tobion/patch-2 (PR #3679)
Commits
-------

c3483d0 performance improvement of JsonResponse saving 2 assignments and 1 variable

Discussion
----------

performance improvement of JsonResponse

saving 2 assignments and 1 variable
2012-03-23 13:07:31 +01:00
Fabien Potencier d1f55e005e merged branch drmonty/patch-1 (PR #3680)
Commits
-------

b75808b fixed typo in CHANGELOG-2.1.md
887d70f fixed small typo in UPGRADE-2.1.md

Discussion
----------

Fixed typo in CHANGELOG-2.1.md and UPGRADE-2.1.md

changed "Foudation" to "Foundation".
2012-03-23 13:05:57 +01:00
Fabien Potencier 43c01bc543 [Process] renamed waitForTermination() to wait() 2012-03-23 13:03:51 +01:00
Fabien Potencier 2be7c66d3a [Process] fixed CS 2012-03-23 13:03:47 +01:00
Fabien Potencier 4eec697c01 merged branch drak3/process-control (PR #3681)
Commits
-------

f9f51a5 fixed cs
af65673 [Process] Added support for non-blocking process control Added methods to control long running processes to the Process class:  - A non blocking start method to startup a process and return    immediately  - A blocking waitForTermination method to wait for the processes    termination  - A stop method to stop a process started with start All status-getters like getOutput were changed to return real-time data

Discussion
----------

[Process] Added support for non-blocking process control

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

Added methods to control long running processes (as described in issue #1049) to the Process class:
 - A non blocking start method to startup a process and return
   immediately
 - A blocking waitForTermination method to wait for the processes
   termination
 - A stop method to stop a process started with start
All status-getters like getOutput were changed to return real-time data

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

by Seldaek at 2012-03-23T10:52:30Z

Overall this seems like a good improvement. I didn't check the code in detail though.

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

by drak3 at 2012-03-23T11:21:45Z

@stof @Seldaek thanks, fixed
2012-03-23 12:49:19 +01:00
Fabien Potencier def4323dc8 fixed CS 2012-03-23 12:47:42 +01:00
Fabien Potencier dd7efb7f36 merged branch Seldaek/auth_logging (PR #3682)
Commits
-------

da0bd7d [Security] Log file/line that triggered the AccessDeniedException

Discussion
----------

[Security] Log file/line that triggered the AccessDeniedException

I had to debug some strange issue in a complex system and with all the nested requests and such, knowing exactly what was triggering the login page to show up wasn't so easy. This helps (unless you use annotations, but the JMSSecurityExtra bundle could use a custom exception class that overrides getLine/getFile and makes it point to the annotation line).
2012-03-23 12:39:07 +01:00
drak3 f9f51a5ca3 fixed cs 2012-03-23 12:06:08 +01:00
Jordi Boggiano da0bd7d0b1 [Security] Log file/line that triggered the AccessDeniedException 2012-03-23 11:42:13 +01:00
drak3 af65673363 [Process] Added support for non-blocking process control
Added methods to control long running processes to the Process class:
 - A non blocking start method to startup a process and return
   immediately
 - A blocking waitForTermination method to wait for the processes
   termination
 - A stop method to stop a process started with start
All status-getters like getOutput were changed to return real-time data
2012-03-23 11:12:57 +01:00
drmonty b75808b282 fixed typo in CHANGELOG-2.1.md 2012-03-23 08:20:03 +01:00
drmonty 887d70f5f6 fixed small typo in UPGRADE-2.1.md 2012-03-23 08:16:11 +01:00
Tobias Schultze c3483d0eb9 performance improvement of JsonResponse saving 2 assignments and 1 variable 2012-03-22 22:53:40 +01:00
Fabien Potencier 54ce7c75e8 merged 2.0 2012-03-22 20:34:27 +01:00
Fabien Potencier 971c71f11e 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
2012-03-22 20:16:01 +01:00
aubx d42ae470ec Added Croatian validator translation for 2.0 2012-03-22 19:57:58 +01:00
Fabien Potencier c761d0cebb 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.
2012-03-22 14:11:08 +01:00
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
Joe Lencioni 1422133ad0 [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: -
2012-03-22 07:58:46 -05: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
Joe Lencioni 5910ac91d7 [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: -
2012-03-21 16:57:29 -05: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
Joe Lencioni 3e7eebd91f [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: -
2012-03-21 15:50:32 -05:00