Commit Graph

8509 Commits

Author SHA1 Message Date
Jordi Boggiano bafcaafbe6 Removed version field 2012-02-27 09:59:20 +01:00
Jordi Boggiano f9d9dc7ce9 Add branch-alias for composer 2012-02-25 03:26:20 +01:00
Fabien Potencier a1370c97d5 merged branch Seldaek/fixtests (PR #3438)
Commits
-------

e67f8d4 Properly skip memcached tests when no memcached server is present
005d86f Broaden timer tests limits
001c4fd Fix windows fs tests

Discussion
----------

Fix tests

- Some windows fixes
- Skip memcached for real when it's not there - by the way I think those tests are insane since they seem to run a purge() on the memcached server. If you run this by accident somewhere where it matters it could hurt. I think they should be put in a group disabled by default, I'll be happy to add that change if it's deemed useful.
- Fixed the timer tests for good on windows (which seems to be quite bad at `usleep`). I also documented them so you actually know how it failed when it does, the false instead of true wasn't super useful.
2012-02-24 11:31:25 +01:00
Jordi Boggiano e67f8d4a82 Properly skip memcached tests when no memcached server is present 2012-02-23 20:37:26 +01:00
Jordi Boggiano 005d86f4db Broaden timer tests limits 2012-02-23 20:36:56 +01:00
Jordi Boggiano 001c4fd064 Fix windows fs tests 2012-02-23 20:36:22 +01:00
Fabien Potencier 88b40e92d8 merged branch jmikola/patch-2 (PR #3433)
Commits
-------

15c6ba9 [HttpKernel] Fix call to Memcached::set() once again

Discussion
----------

[HttpKernel] Fix call to Memcached::set() once again

I originally fixed this in #3358, but it appears #3363 (which touched the same line) was merged soon after.
2012-02-23 19:22:16 +01:00
Jeremy Mikola 15c6ba93f6 [HttpKernel] Fix call to Memcached::set() once again
I originally fixed this in #3358, but it appears #3363 (which touched the same line) was merged soon after.
2012-02-23 13:15:05 -05:00
Fabien Potencier 0ff21973f9 merged branch Seldaek/profiler_route (PR #3426)
Commits
-------

957bbcb [WebProfiler] Add default route to access the profiler more easily

Discussion
----------

[WebProfiler] Add default route to access the profiler more easily

When you have the toolbar disabled, it's pretty annoying to reach the _profiler, I never remember what to type to get something except `/_profiler`. This shows the last ten runs which is quite useful.
2012-02-23 19:11:12 +01:00
Fabien Potencier be92973512 merged branch arnaud-lb/apache-matcher-fixes (PR #3406)
Commits
-------

e6e9b5a [Routing] Return the _route parameter from ApacheUrlMatcher

Discussion
----------

[Routing] Return the _route parameter from ApacheUrlMatcher

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

by fabpot at 2012-02-22T23:13:49Z

Can you squash  your commits before I merge? Thanks.

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

by arnaud-lb at 2012-02-23T09:12:45Z

sure, done
2012-02-23 19:06:54 +01:00
Fabien Potencier 207cdb821d merged branch johnnypeck/patch-1 (PR #3421)
Commits
-------

b36f2c8 "Locate" should be "Locale"

Discussion
----------

"Locate" should be "Locale"

Tiny change for a misspelling.
2012-02-23 19:03:18 +01:00
Jordi Boggiano 957bbcbd15 [WebProfiler] Add default route to access the profiler more easily 2012-02-23 15:21:34 +01:00
Arnaud Le Blanc e6e9b5adbe [Routing] Return the _route parameter from ApacheUrlMatcher 2012-02-23 10:11:35 +01:00
Johnny Peck b36f2c8211 "Locate" should be "Locale" 2012-02-22 23:10:06 -05:00
Fabien Potencier 611b241f56 fixed CS 2012-02-22 19:03:34 +01:00
Fabien Potencier f373085928 merged 2.0 2012-02-22 18:59:56 +01:00
Fabien Potencier 333b4f72fc merged branch stealth35/trans_res_dump (PR #3412)
Commits
-------

bffbb5e typo
b82862a [Translation] Add IcuResFileDumper
8e569dd [Translation] ResourceBundleLoader to IcuRes/DatFileLoader

Discussion
----------

[Translation] Refactor ResourceBundle Translation

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

 - Rename `ResourceBundleLoader` to `IcuResFileLoader` and `IcuDatFileLoader`
 - Proud to announce the `IcuResFileDumper`
2012-02-22 16:48:57 +01:00
Fabien Potencier 7ef09ab28d merged branch vicb/config/proto/default (PR #3403)
Commits
-------

b269e27 [Config] Improve handling of PrototypedArrayNode defaults
4feba09 [Config] implements feedback
bc122bd [Config] Fix nested prototyped array nodes
675e5eb [Config] Take advantage of the new PrototypedArrayNode API in the core bundles
cba2c33 [Config] Improve error messages & extensibility
bca2b0e [Config] Improve PrototypedArrayNode default value management

Discussion
----------

[Config] Improve prototype nodes usability, error messages, extensibility

### First commit

*Before* (you should set multiple defalutValues)

```php
<?php
$root
    ->arrayNode('node')
    ->prototype('array')
        // when the node is not set
        ->defaultValue(array('foo' => 'bar')
        ->children()
            // when the key is not set
            ->scalarNode('foo')->defaultValue('bar')->end()

$root
    ->arrayNode('node')
    ->prototype('array')
        // when the node is not set
        ->defaultValue(array('defaults' => array('foo1' => 'bar1', 'foo2' => 'bar2')
        ->children()
            ->arrayNode('bar')
                // when the node is not set
                ->addDefautsIfNotSet()
                // when some values are not set (node being set)
                ->scalarNode('foo1')->defaultValue('bar1')->end()
                ->scalarNode('foo2')->defaultValue('bar2')->end()
```

*after*

```php
<?php
$root
    ->arrayNode('node')
    ->addDefaultChildrenWhenNoneSet()
    ->prototype('array')
        ->children()
            ->scalarNode('foo')->defaultValue('bar')->end()

$root
    ->arrayNode('node')
    ->addDefaultChildrenWhenNoneSet()
    ->prototype('array')
        ->children()
            ->arrayNode('bar')
                ->scalarNode('foo1')->defaultValue('bar1')->end()
                ->scalarNode('foo2')->defaultValue('bar2')->end()
```

*more* (exclusive configs)

```php
<?php
$root
    ->arrayNode('node')
    // Add a default node named 'defaults'
    ->addDefaultChildrenWhenNoneSet()
    // Add a default node named 'foo'
    ->addDefaultChildrenWhenNoneSet('foo')
    // Add two default nodes named 'foo', 'bar'
    ->addDefaultChildrenWhenNoneSet(array('foo', 'bar'))
    // Add two default nodes
    ->addDefaultChildrenWhenNoneSet(2)
```

### Second commit

Improves error messages (print the path to the error) & extensibility.

@schmittjoh I would appreciate you feedback on both the commits. Do you think a boolean $throw switch on `getNode` would make sense (i.e. to prevent throwing excs in prod ?).

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

by schmittjoh at 2012-02-20T15:43:18Z

The error improvements seem uncontroversial.

I'm not so convinced by the other changes though. What if the prototype is a map and not a simple list?

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

by vicb at 2012-02-20T16:07:51Z

I think there's one caveat left in the code as it is now that I will fix (nested prototypes).

Could you please give me more details on the use case you are referring to ?

You do not have to use the new feature but It can be really helpful [here](https://github.com/symfony/symfony/pull/3225/files#L4R38) for example.

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

by schmittjoh at 2012-02-20T17:20:02Z

What I mean is something like this:

```php
->arrayNode("foo")
    ->useAttributeAsKey("name")
    ->prototype(/* ...
```

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

by vicb at 2012-02-20T17:28:01Z

What would be wrong then ? (that's the use case I link in my previous msg)

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

by schmittjoh at 2012-02-20T17:28:55Z

How would adding defaults look like?

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

by vicb at 2012-02-20T17:36:35Z

Check the "more" part of the PR message.

In the linked use case, it would add a "defaults" server using the default host / port / weight. In this case I do not care about the name but the values are important to help alias the equivalent configs. You can override the "defaults" name by using a parameter.

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

by vicb at 2012-02-20T17:47:27Z

```php
<?php
// [...]
    ->arrayNode('servers')
        ->addDefaultChildrenWhenNodeSet()
        ->useAttributeAsKey('name')
        ->prototype('array')
            ->children()
```

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

by schmittjoh at 2012-02-20T17:47:54Z

What I was thinking about is having two nodes with different default values. Right now, both nodes while having different keys would still have the same default values which does not make much sense to me. However, we can address this in another PR.

One thing that we should fix though is that we should require keys in case of a map, and forbid them in case of a list. It might make sense to split it into different methods. Like the following examples make no sense (but are possible atm):

```php
->arrayNode("foo")
    ->useAttributeAsKey("name")
    ->addDefaultChildrenIfNotSet(5)

->arrayNode("foo")
    ->addDefaultChildrenIfNotSet("foo")
    ->prototype("scalar")->end()
```

Another minor nitpick, please rename "when" to "if".

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

by vicb at 2012-02-20T18:03:19Z

@schmittjoh thank you for your feedback.

message-2:

* I think the first case is fine (children "1" to "5"). Sometimes you just don't care about the names so it should not be forbidden.
* I also think the second case is fine as you would write `foo: value` in your config file anyway.

Let me know your thoughts about the previous statements.

Agree to change when to if.

message-1:

Will change

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

by vicb at 2012-02-20T18:06:33Z

I think "IfNoneSet" is more accurate than "IfNotSet" ?

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

by schmittjoh at 2012-02-20T18:09:59Z

If you call "useAttributeAsKey" it automatically means that the keys are meaningful to you (otherwise there is no point in calling it). In such a case, keys should be explicitly given.

On the other hand, if you do not call it, then the keys are ignored/dropped by the Config component. So if you give a key, it is an obvious error that we should catch. The second case I linked would look like ``foo: [value]`` in contrast to ``foo: { foo: value }``.

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

by schmittjoh at 2012-02-20T18:14:44Z

I'm not feeling strongly about this, but "IfNotSet" is more consistent with
"addDefaultsIfNotSet" and basically reads as "if array node is not set, do
...". Your example would refer to the children and read as "if none
(children) have been defined, do ...".

On Mon, Feb 20, 2012 at 12:06 PM, Victor Berchet <
reply@reply.github.com
> wrote:

> I think "IfNoneSet" is more accurate than "IfNotSet" ?
>
> ---
> Reply to this email directly or view it on GitHub:
> https://github.com/symfony/symfony/pull/3403#issuecomment-4058579
>

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

by vicb at 2012-02-20T18:30:21Z

message-2:

* Agree on first point, will change
* You could specify the keys in your config file if the prototype is an array (you used a scalar). Should we implement a switch in the validation (i.e. array / not array) or just go with numeric / null arg  as you suggest ?

message-1:

> Your example would refer to the children and read as "if none (children) have been defined, do ..."

QED

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

by vicb at 2012-02-20T22:11:05Z

@schmittjoh I have implemented your suggestions (other than the "NoneSet"). Let me know if you think this is ok. Thanks.

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

by schmittjoh at 2012-02-21T03:24:19Z

Looks good to me.

As an additional improvement we might consider to allow to prepopulate an prototyped with values. For example, in the FOSRestBundle there is a case where this could be used.

```php
->arrayNode('formats')
    ->prepopulateValues(array('application/json' => 'json', 'application/xhtml+xml' => 'xml'))
    ->useAttributeAsKey('name')
    ->prototype('scalar')->canBeUnset()->end()
```

This could be done in a separate PR however and is not strictly related to these improvements.

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

by vicb at 2012-02-21T07:51:59Z

@schmittjoh that would be a great addition but I think need some thinking (i.e. the name, `initialValues` ?, should we handle duplicates, how - in case we are not using attribue as key, ...) so let's make an other PR, I'd like this one to be merged asap as I need this for the Cache Bundle.

@fabpot ready
2012-02-22 16:32:31 +01:00
stealth35 bffbb5e324 typo 2012-02-22 16:28:56 +01:00
stealth35 b82862aef5 [Translation] Add IcuResFileDumper 2012-02-22 16:15:11 +01:00
stealth35 8e569dd976 [Translation] ResourceBundleLoader to IcuRes/DatFileLoader 2012-02-22 16:14:47 +01:00
Fabien Potencier 7474ad5075 merged branch stof/monolog_chromephp (PR #3401)
Commits
-------

1953280 [MonologBridge] updated the class name from Monolog
96da7c8 [MonologBridge] Added the user agent check for the ChromePhpHandler
f7aa6c0 [MonologBridge] Added the Response-aware ChromePhpHandler

Discussion
----------

[MonologBridge] Added the Response-aware ChromePhpHandler

This adds an extended ChromePhpHandler based on the Response class to set the headers, similar to the extended FirePHPHandler.

This PR depends on Seldaek/monolog#58

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

by stof at 2012-02-20T16:36:47Z

@fabpot The monolog PR is merged now so this one is ready

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

by stloyd at 2012-02-20T17:11:14Z

@stof You need to rename file and class name to: [`ChromePHPHandler`](8d4ac5c0f7)

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

by fabpot at 2012-02-22T09:16:46Z

@stloyd is right. As per Symfony standard, you should use `ChromePhpHandler` for the Symfony class and `SymfonyPHPHandler` for the Monolog one.

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

by stof at 2012-02-22T09:22:27Z

@fabpot updated
2012-02-22 10:29:29 +01:00
Christophe Coevoet 1953280da4 [MonologBridge] updated the class name from Monolog 2012-02-22 10:21:12 +01:00
Fabien Potencier 2f33b5d1f2 merged branch marcw/patch-license-copyright (PR #3411)
Commits
-------

89868f7 Updated LICENSE files copyright

Discussion
----------

Updated LICENSE files copyright
2012-02-22 10:13:19 +01:00
Fabien Potencier 96e9fddc6a merged branch drak/sessionhandlerinterface (PR #3384)
Commits
-------

2871ea0 Update composer for HttpFoundation's PHP 5.4 forward compatibility.
ff8d740 [Locale] Update documentation for autoloader.
dd2c4aa [HttpFoundation] Documentation.
e585ca7 [HttpFoundation] Added forward compatibility for \SessionHandlerInterface
d339e74 [ClassLoader] Add ability to incrementally register fallbacks.

Discussion
----------

[HttpFoundation] PHP 5.4 forward compatibility  for \Sessionhandlerinterface

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

Utilising the same forward method as in Locale (as requested by @fabpot)

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

by stof at 2012-02-16T20:59:27Z

forward compatibility sent to the master branch, really ?

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

by stof at 2012-02-16T21:00:12Z

Ok, looking at the patch, it is not the same than places where we used the naming "forward compatibility". Sorry

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

by stof at 2012-02-16T21:01:56Z

As this fallback is mandatory to be able to use the component on 5.3, which is our target, please register the fallback in the composer.json file of the component and of the main repo so that it works out of the box when using Composer.

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

by drak at 2012-02-17T02:55:17Z

@stof as a native English speaker I find the terminology used in Symfony2 upside down. "Backward compatible" means compatible with past versions, i.e. legacy.  "Forward compatibility" logically means compatible with future versions - which in this case we are making an interface available in PHP 5.4, available in PHP 5.3.

I will try to adapt my in the context of Sf2's terminology :-)

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

by drak at 2012-02-17T02:56:43Z

Ah I see what you are saying, you mean normally things are made forward compatible from Symfony 2.0 to 2.1, and in this case we're making a native PHP interface forward compatible: so actually we are on the same page :)

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

by drak at 2012-02-17T02:59:00Z

@stof - I took a look at the `composer.json` and I also don't see and handling for the `Locale` component fallback (as written in `autoloader.php.dist`.  Is it even possible in Composer? /cc @Seldaek

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

by stof at 2012-02-17T07:03:44Z

@drak for the Locale, we don't register it through composer as we cannot do it fully: the stub functions are not autoloadable so it will always require some user work to do this. But for the HttpFoundation stub, it is possible as it is autoloadable:

```json
{
    autoload: {
        psr-0: {
            'Symfony\\Component\\HttpFoundation': '',
            '': 'Symfony/Component/HttpFoundation/Resources/stub'
        }
    }
}
```

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

by drak at 2012-02-17T08:11:56Z

Awesome @stof, thanks for the tip.

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

by drak at 2012-02-17T08:18:44Z

@stof do I also need to update the main repo's composer.json file too?

```
"autoload": {
        "psr-0": {
            "Symfony": "src/",
            "": "src/Symfony/Component/HttpFoundation/Resources/stub"
        }
    }

```

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

by Seldaek at 2012-02-17T08:54:46Z

I would use that in the autoload just to avoid file_exists calls for nothing:

```json
            "SessionHandlerInterface": "src/Symfony/Component/HttpFoundation/Resources/stub"
```

The class is part of the "prefix" too.

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

by drak at 2012-02-21T12:32:23Z

This is ready for merge @fabpot

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

by drak at 2012-02-21T16:20:43Z

@fabpot - done.
2012-02-22 10:12:06 +01:00
marc.weistroff 89868f7901 Updated LICENSE files copyright 2012-02-22 10:10:37 +01:00
Drak 2871ea062e Update composer for HttpFoundation's PHP 5.4 forward compatibility. 2012-02-22 07:07:18 +05:45
Drak ff8d740753 [Locale] Update documentation for autoloader. 2012-02-22 07:07:14 +05:45
Drak dd2c4aa61f [HttpFoundation] Documentation. 2012-02-22 07:07:11 +05:45
Drak e585ca783d [HttpFoundation] Added forward compatibility for \SessionHandlerInterface 2012-02-22 07:07:07 +05:45
Drak d339e74bc5 [ClassLoader] Add ability to incrementally register fallbacks.
This is useful in the cases where you might be adding forward compat
classes to several components.
2012-02-22 07:07:03 +05:45
Fabien Potencier 74ebd057a1 merged branch tna/session-cache-limiter (PR #3400)
Commits
-------

fb2bb65 [HttpFoundation] Fix session.cache_limiter is not set correctly

Discussion
----------

[HttpFoundation] Fix session.cache_limiter is not set correctly

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

Fixes a regression after the session refactoring where extra cache control http headers are sent.

This was previously handled by [calling session_cache_limiter(false) in NativeSessionStorage](https://github.com/symfony/symfony/blob/2.0/src/Symfony/Component/HttpFoundation/SessionStorage/NativeSessionStorage.php#L81)

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

by drak at 2012-02-21T12:23:48Z

@fabpot - this code can be merged imo.
2012-02-21 14:47:46 +01:00
Fabien Potencier dc1ff89a94 merged branch mazen/fix-memcached-sessions (PR #3399)
Commits
-------

6fbd290 Improved unit tests for MemcacheSessionStorage
b4c5323 Added comma to array initializer, reverted permissions back to 644
3dd851a Use correct parameters
0e01418 Fix default if no serverpool is provided
2a65121 Fix several issues in MemccheSessionStorage which prevented it from being used correctly

Discussion
----------

Fix several issues in MemcacheSessionStorage

Apperently this could never have worked unless someone passed wrong arguments to the options.

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

by mazen at 2012-02-19T07:58:52Z

```
[marcel@development symfony]$ phpunit tests/Symfony/Tests/Component/HttpFoundation/Session/Storage/MemcacheSessionStorageTest.php
PHPUnit 3.6.10 by Sebastian Bergmann.

Configuration read from /www/includes/vendor/symfony/phpunit.xml.dist

......

Time: 0 seconds, Memory: 3.75Mb

OK (6 tests, 11 assertions)
```

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

by lsmith77 at 2012-02-19T16:10:13Z

cc @drak

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

by drak at 2012-02-19T17:44:00Z

Looks like we could do with some tests for the constructor that also test the defaults and the internal properties.  And also more extensively tests the mock to test the addServer behaviour.

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

by helmer at 2012-02-19T18:02:03Z

@mazen You've changed file permissions from 644->755 ..

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

by drak at 2012-02-21T12:25:11Z

@fabpot - with the extra tests added in 6fbd290 I believe this code is ready for merge.
2012-02-21 14:47:18 +01:00
Fabien Potencier c06fecf604 merged branch patrick-mcdougle/patch-1 (PR #3405)
Commits
-------

c1c0f6f Fixed a doc block

Discussion
----------

Fixed a doc block

The doc block had incorrect text.
2012-02-21 14:37:06 +01:00
Victor Berchet b269e27191 [Config] Improve handling of PrototypedArrayNode defaults 2012-02-20 23:07:03 +01:00
Victor Berchet 4feba09aa9 [Config] implements feedback 2012-02-20 19:15:01 +01:00
patrick-mcdougle c1c0f6f64b Fixed a doc block 2012-02-20 11:24:42 -06:00
Victor Berchet bc122bdb2d [Config] Fix nested prototyped array nodes 2012-02-20 18:01:14 +01:00
Fabien Potencier 9356be3a1b Revert "fixed tests for the latest Twig"
This reverts commit 3236fc5af3.
2012-02-20 13:28:51 +01:00
Victor Berchet 675e5eb6e0 [Config] Take advantage of the new PrototypedArrayNode API in the core bundles 2012-02-20 11:20:39 +01:00
Victor Berchet cba2c332ad [Config] Improve error messages & extensibility 2012-02-20 10:45:28 +01:00
Victor Berchet bca2b0edf3 [Config] Improve PrototypedArrayNode default value management 2012-02-20 10:45:21 +01:00
Christophe Coevoet 96da7c8c44 [MonologBridge] Added the user agent check for the ChromePhpHandler 2012-02-20 02:34:53 +01:00
Christophe Coevoet f7aa6c006e [MonologBridge] Added the Response-aware ChromePhpHandler 2012-02-20 01:10:53 +01:00
Tobias Naumann fb2bb65b1e [HttpFoundation] Fix session.cache_limiter is not set correctly 2012-02-19 21:07:38 +01:00
Marcel Beerta 6fbd2902be Improved unit tests for MemcacheSessionStorage 2012-02-19 19:54:54 +01:00
Marcel Beerta b4c53238b0 Added comma to array initializer, reverted permissions back to 644 2012-02-19 19:31:41 +01:00
Marcel Beerta 3dd851afed Use correct parameters 2012-02-19 13:22:38 +01:00
Marcel Beerta 0e0141805c Fix default if no serverpool is provided 2012-02-19 08:56:31 +01:00
Marcel Beerta 2a65121865 Fix several issues in MemccheSessionStorage which prevented it from being used correctly 2012-02-19 08:46:28 +01:00