Commit Graph

9212 Commits

Author SHA1 Message Date
Fabien Potencier
37c9fe9a2b merged branch Seldaek/validator_yaml (PR #3794)
Commits
-------

8ceb569 Fix typo
8702ea5 [Validator] Allow empty keys in the validation config

Discussion
----------

[Validator] Allow empty keys in the validation config

This allows you to just list fields that don't have validation rules (yet), for future reference it's kinda helpful. Right now if they're not commented out a fatal is thrown because null isn't an array.

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

by bschussek at 2012-04-05T15:34:09Z

Could you add a test please?

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

by Seldaek at 2012-04-05T15:34:48Z

The dummy key I added in the test makes it fail without the fix.

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

by bschussek at 2012-04-05T15:46:54Z

Ah, that's perfect, I overlooked that. Thanks!
2012-04-06 14:14:01 +02:00
Fabien Potencier
c392f747b8 merged branch drak/ismethod (PR #3800)
Commits
-------

33881dd [HttpFoundation] Add more tests for casing
aec1339 [HttpFoundation] Coding standards.
bf33bd4 update changelog
3dc72cd Add isMethod() to Request object

Discussion
----------

[HttpFoundation] Add isMethod() to Request object.

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

Justification is for convenience.

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

by hhamon at 2012-04-06T07:14:44Z

+1
2012-04-06 14:11:35 +02:00
Jordi Boggiano
595cc11251 [Console] Wrap exception messages to the terminal width to avoid ugly output 2012-04-06 13:54:54 +02:00
Jordi Boggiano
97f7b29783 [Console] Avoid outputing \r's in exception messages 2012-04-06 13:51:32 +02:00
Drak
33881ddd30 [HttpFoundation] Add more tests for casing 2012-04-06 17:10:55 +05:45
Hugo Hamon
04ae7cc605 [Routing] fixed exception message. 2012-04-06 11:45:36 +02:00
Hugo Hamon
f7647f9325 [Routing] improved exception message when giving an invalid route name. 2012-04-06 10:49:41 +02:00
Drak
aec133996e [HttpFoundation] Coding standards. 2012-04-06 07:29:37 +00:00
Drak
bf33bd469d update changelog 2012-04-06 06:51:39 +00:00
Drak
3dc72cdf21 Add isMethod() to Request object 2012-04-06 12:35:12 +05:45
Konrad Mohrfeldt
f617e02a96 [Validator] added less-strict email host verification
New checkHost attribute in email constraint will
make the validator check for only one of MX, A or AAAA
DNS resource records to verify it as a valid
email address.
2012-04-06 02:33:41 +02:00
Jordi Boggiano
8ceb569b52 Fix typo 2012-04-05 19:10:13 +02:00
Jordi Boggiano
8702ea5f6d [Validator] Allow empty keys in the validation config 2012-04-05 17:21:24 +02:00
Markus Lanthaler
0ccb6fa48d [Yaml] fixed phpdoc (closes symfony/Yaml#3) 2012-04-05 15:34:56 +02:00
Johannes
0024ddce9c Fix for using route name as check_path. 2012-04-05 12:20:11 +03:00
Fabien Potencier
6bcd0a2d40 merged branch drak/caed (PR #3783)
Commits
-------

d04638a [EventDispatcher] More logical positions for classes.

Discussion
----------

[EventDispatcher] More logical positions for classes.

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

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

by stof at 2012-04-04T18:59:02Z

ah sorry, I looked at the patch too fast. Only the interface is moved
2012-04-05 08:11:42 +02:00
Fabien Potencier
fec3d29ea8 merged branch marcw/feat-patch-changelog (PR #3788)
Commits
-------

f5bc208 Updates CHANGELOG for commit f718859.

Discussion
----------

Updates CHANGELOG for commit f718859.
2012-04-05 08:10:14 +02:00
Fabien Potencier
404e58fdef merged branch excelwebzone/hebrew_translations (PR #3787)
Commits
-------

bec2f0f Fix hebrew grammar
1b48abb Hebrew translation update

Discussion
----------

Hebrew translation update
2012-04-05 08:10:03 +02:00
marc.weistroff
f5bc20800c Updates CHANGELOG for commit f718859. 2012-04-05 07:18:00 +02:00
excelwebzone
bec2f0f70a Fix hebrew grammar 2012-04-04 19:12:09 -07:00
excelwebzone
1b48abbfa2 Hebrew translation update 2012-04-04 19:07:45 -07:00
Drak
d04638a9b5 [EventDispatcher] More logical positions for classes. 2012-04-04 22:03:00 +05:45
Fabien Potencier
b4a44fecc9 merged branch stof/en_translations (PR #3782)
Commits
-------

a2f65f7 [FrameworkBundle] Added the translation file for the en locale

Discussion
----------

[FrameworkBundle] Added the translation file for the en locale

This fixes the translation when the fallback is set to another language.
This new file can be used as reference by translators to find missing keys
in their translations as every contributor will be able to update it when
adding new keys.

See the discussion on #3773
2012-04-04 17:34:36 +02:00
Christophe Coevoet
a2f65f7dfa [FrameworkBundle] Added the translation file for the en locale
This fixes the translation when the fallback is set to another language.
This new file can be used as reference by translators to find missing keys
in their translations as every contributor will be able to update it when
adding new keys.
2012-04-04 17:23:03 +02:00
John Bohn
b6ac1aa912 [FORM] Give PropertyPath ability to read hassers 2012-04-04 09:49:16 -05:00
Thomas Chmielowiec (chmielot)
a430f3d8a6 [#3446] [Form] Fix getChoicesForValues of EntityChoiceList on empty values 2012-04-04 15:46:22 +02:00
Rui Marinho
fc41d4f223 [Security] [HttpDigest] Fixes a configuration error caused by an invalid 'key' child node configuration 2012-04-04 14:28:24 +01:00
Fabien Potencier
e4ebffb01b Revert "merged branch ruimarinho/http_digest (PR #3778)"
This reverts commit eb6a26f572, reversing
changes made to a10fee16c1.
2012-04-04 13:13:39 +02:00
Fabien Potencier
eb6a26f572 merged branch ruimarinho/http_digest (PR #3778)
Commits
-------

fd1ea69 [Security] [HttpDigest] Fixes a configuration error caused by an invalid key child node configuration

Discussion
----------

[Security] [HttpDigest] Fixes a configuration error caused by an invalid "key" child node configuration

```
Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
```
2012-04-04 12:56:30 +02:00
Rui Marinho
fd1ea69b78 [Security] [HttpDigest] Fixes a configuration error caused by an invalid key child node configuration 2012-04-04 11:36:25 +01:00
Fabien Potencier
71c9dc31f4 merged branch stof/routing_options_import (PR #3775)
Commits
-------

3c32569 [Routing] Added the possibility to define options for imported resources

Discussion
----------

[Routing] Added the possibility to define options for imported resources

Closes #2772
2012-04-04 08:59:44 +02:00
Fabien Potencier
479d808e6e Revert "merged branch jfsimon/master (PR #3613)"
This reverts commit 959158f9b9, reversing
changes made to b9de0be349.
2012-04-04 08:53:58 +02:00
Fabien Potencier
97fd965b70 merged branch stloyd/patch-3 (PR #3771)
Commits
-------

1456e1e Polish translations sync

Discussion
----------

[Validators] Polish translations sync
2012-04-04 08:00:11 +02:00
Fabien Potencier
21b45f2e19 merged branch pulzarraider/translation_update_sk (PR #3772)
Commits
-------

b5de295 Slovak translation update

Discussion
----------

[FrameworkBundle] Slovak translation update
2012-04-04 08:00:01 +02:00
Christophe Coevoet
3c325698ac [Routing] Added the possibility to define options for imported resources
Closes #2772
2012-04-04 03:36:42 +02:00
Andrej Hudec
b5de295e40 Slovak translation update 2012-04-03 23:48:25 +02:00
Joseph Bielawski
1456e1ea64 Polish translations sync 2012-04-04 00:40:52 +03:00
Fabien Potencier
e5121e91c8 merged branch maastermedia/translations (PR #3769)
Commits
-------

2519544 slovenian translations updated to latest list

Discussion
----------

Slovenian translations updated to latest list

Thank you!
2012-04-03 23:10:30 +02:00
Peter Kokot
251954476c slovenian translations updated to latest list 2012-04-03 22:16:08 +02:00
Fabien Potencier
959158f9b9 merged branch jfsimon/master (PR #3613)
Commits
-------

2a90871 [Console] Removed previously introduced BC break.
90a2a6e [Console] Undecorated formatter must update style stack too.
bd7e01a [Console] Fixed output formatter test broken by new implementation.
a1add4b [Console] Updated output formatter to use style stack.
4f298dd [Console] Added formatter style stack.
93ffe54 [Console] Added getters to output formatter style (and its interface).
48e6b49 [Console] Updated formatter test to match styles bug fix.
ad334b6 [Console] Fixed empty style appliance.
31d5fe5 [Console] Fixed output formatter docblock.

Discussion
----------

[Console] Fixes formatter nested style appliance.

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

When outputing styled text in the console, you sometimes face to a confusing behavior: style tags cannot be nested. If tou try something like `<fg=blue>Hello <fg=red>world</fg=red>!</fg=blue>`, the trailing `!` will not be styled.

This PR introduce a new FormatterOutputStyleStack to keep open/closed styles informations up-to-date. It slightly changes OutputFormatter implementation which no longer uses `OutputFormatterStyle::apply()` method, but the new `OutputFormatterStyle::getTerminalSequence()`.

**Question:** I don't une `OutputFormatterStyleInterface` but `OutputFormatterStyle` to type `OutputFormatterStyleStack` methods arguments (to avoid BC break on the interface). Do you think it's right?

**Notice:** I also needed to fix some tests broken by new implementation.

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

by stof at 2012-03-16T10:27:56Z

Adding new methods in an interface is a BC break for people implementing it

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

by jfsimon at 2012-03-16T10:33:21Z

@stof indeed... this is a problem, should I remove them? If I do so, I should use `OutputFormatterStyle` instead of the interface to type arguments in `OutputFormatterStyleStack` right?
2012-04-03 12:02:29 +02:00
Fabien Potencier
b9de0be349 merged branch drak/sessionmeta (PR #3718)
Commits
-------

8a0e6d2 [HttpFoundation] Update changelog.
4fc04fa [HttpFoundation] Renamed MetaBag to MetadataBag
2f03b31 [HttpFoundation] Added the ability to change the session cookie lifetime on migrate().
39141e8 [HttpFoundation] Add ability to force the lifetime (allows update of session cookie expiry-time)
ec3f88f [HttpFoundation] Add methods to interface
402254c [HttpFoundation] Changed meta-data responsibility to SessionStorageInterface
d9fd14f [HttpFoundation] Refactored for moved tests location.
29bd787 [HttpFoundation] Added some basic meta-data to Session

Discussion
----------

[2.1][HttpFoundation] Added some basic meta-data to Session

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

Session data is stored as an encoded string against a single id.  If we want to store meta-data about the session, that data has to be stored as part of the session data to ensure the meta-data can persist using any session save handler.

This patch makes it much easier to determine the logic of session expiration.  In general a session expiry can be dealt with by the gc handlers, however, in some applications more specific expiry rules might be required.

Session expiry may also be more complex than a simple, session was idle for x seconds.  For example, in Zikula there are three security settings, Low, Medium and High.  The rules for session expiry are more complex as under the Medium setting, a session will expire after x minutes idle time, unless the rememberme option was ticked on login.  If so, the session will not idle.  This gives the user some control over their experience.  Under the high security setting, then there is no option, sessions will expire after the idle time is reached and login the UI has the rememberme checkbox removed.

The other advantage is that under this methodology, there can be a UI experience on expiry, like "Sorry, your session expired due to being idle for 10 minutes".

Keeping in the spirit of Symfony2 Components, I am seeking to make session handling flexible enough to accommodate these general requirements without specifically covering expiration rules. It would mean that it would be up to the implementing application to specifcally check and expire session after starting it.

Expiration might look something like this:

    $session->start();
    if (time() - $session->getMetadataBag()->getLastUpdate() > $maxIdleTime) {
        $session->invalidate();
        throw new SessionExpired();
    }

This commit also brings the ability to change the `cookie_lifetime` when migrating a session. This means one could move from a default of browser only session cookie to long-lived cookie when changing from a anonymous to a logged in user for example.

    $session->migrate($destroy, $lifetime);

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

by drak at 2012-03-30T18:18:43Z

@fabpot I have removed [WIP] status.

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

by drak at 2012-03-31T13:34:57Z

NB: This PR has been rebased and the tests relocated as per recent master changes.

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

by drak at 2012-04-03T02:16:43Z

@fabpot - ping
2012-04-03 11:40:07 +02:00
Fabien Potencier
262041382f merged branch Tobion/PhpMatcherDumper-Improvement (PR #3763)
Commits
-------

56c1e31 performance improvement in PhpMatcherDumper

Discussion
----------

performance improvement in PhpMatcherDumper

Tests pass: yes

The code generation uses a string internally instead of an array. The array wasn't used for random access anyway.
I also removed 4 unneeded iterations this way (when imploding, when merging and twice when applying the extra indention). A `preg_replace` could also be saved under certain circumstances by moving it.
And there was a small code errror in line 139.
2012-04-03 11:38:13 +02:00
Tobias Schultze
56c1e31e8a performance improvement in PhpMatcherDumper 2012-04-03 09:18:44 +02:00
Fabien Potencier
4923483805 merged branch stof/autoloader_refactoring (PR #3756)
Commits
-------

f1f1494 Added an exception when passing an invalid object to ApcClassLoader
f5cb167 [ClassLoader] Added a DebugClassLoader using composition
0e54a22 Updated the changelog
eae772e [ClassLoader] Added an ApcClassLoader
4d1333f Changed the test autoloading to use the new autoloader
09850bd [ClassLoader] Added a simplified PSR-0 ClassLoader

Discussion
----------

Autoloader refactoring

Bug fix: no
Feature addition: yes
Backwards compatibility break: no
Symfony2 tests pass: [![Build Status](https://secure.travis-ci.org/stof/symfony.png?branch=autoloader_refactoring)](http://travis-ci.org/stof/symfony)

As discussed in #3623, I added a new ClassLoader instead of modifying the UniversalClassLoader, to be able to use the method names without BC concerns. The new class works the same than the composer autoloader regarding the handling of fallbacks, to be able to reuse namespace maps generated by composer.

```php
<?php

// autoload.php
require_once __DIR__.'/vendor/symfony/class-loader/Symfony/Component/ClassLoader/ClassLoader.php';

$loader = new Symfony\Component\ClassLoader\ClassLoader();

$map = require __DIR__.'/vendor/.composer/autoload_namespaces.php';
$loader->addPrefixes($map);

$loader->register();
```

Differences with the composer class loader:

- Composer's ``add`` method is named ``addPrefix`` in the Symfony ClassLoader
- the methods related to the class map are removed as Symfony has a separate laoder for class maps
- the ``addPrefixes`` method is added, accepting a namespace map.

I also added a new ApcClassLoader which uses composition instead of inheriting from a class loader, which makes it far more easier to reuse (we could wrap a Composer autoloader with it for instance).

```php
<?php

$composerLoader = require __DIR__.'/vendor/.composer/autoload.php';

// no need to require the file manually as Composer already registered its autoloader
$cachedLoader = new Symfony\Component\ClassLoader\ApcClassLoader('autoload.my_app', $composerLoader);

$cachedLoader->register();
// unregister the Composer autoloader as we wrapped it in the ApcClassLoader
$composerLoader->unregister();
```

TODO:

- refactor the Debug class loader to use composition too to be able to support different class loaders

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

by fabpot at 2012-04-02T16:31:28Z

Can you update the CHANGELOG and the UPGRADE file accordingly?

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

by stof at 2012-04-02T16:47:43Z

I added a note in the CHANGELOG. There is nothing to add in the UPGRADE file as the change is fully BC (I did not change the UniversalClassLoader at all so it can still be used).

I'm working on the Debug loader right now so please wait a bit before merging

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

by stof at 2012-04-02T17:12:11Z

Here is a new DebugClassLoader using composition too. this way, it is able to support the UniversalClassLoader, the ApcUniversalClassLoader (without dropping the use of APC as done previously), the new ClassLoader, the new ApcClassLoader and even the composer autoloader.
I'm not sure about the use of ``method_exists`` as it could break if an autoloader implements a protected ``findFile`` method (crappy PHP 😢) but hardcoding the supported classes would be a pain and requiring an interface would make the autoloaders more difficult to use (as the interface would need to be required first) and would drop the support of the composer autoloader.
2012-04-02 20:28:07 +02:00
Christophe Coevoet
f1f1494bbf Added an exception when passing an invalid object to ApcClassLoader 2012-04-02 19:53:22 +02:00
Fabien Potencier
2808acd4ae merged branch stof/twig_engine_move (PR #3761)
Commits
-------

dbab7e1 [TwigBridge] Added a TwigEngine in the bridge

Discussion
----------

[TwigBridge] Added a TwigEngine in the bridge

This TwigEngine implements the interface available in the component.
the TwigBridge in TwigBundle now extends this class and provides only
the additional methods for the FrameworkBundle interface.

This will allow people to support the PhpEngine and Twig in their code more easily when using the component as they don't need to reimplement the class.
I originally thought about when I helped @dragoonis to integrate the Templating component in the PPI framework 2.0 as he talked about adding the support for Twig later too.
2012-04-02 19:06:44 +02:00
Christophe Coevoet
f5cb167554 [ClassLoader] Added a DebugClassLoader using composition 2012-04-02 19:03:58 +02:00
Christophe Coevoet
0e54a2277e Updated the changelog 2012-04-02 18:45:31 +02:00
Fabien Potencier
bff89a4aa9 merged branch symfony/event_dispatcher_classes_move (PR #3760)
Commits
-------

93848be moved event dispatcher classes to the EventDispatcher component

Discussion
----------

moved event dispatcher classes to the EventDispatcher component

I have moved the two specialized event dispatcher classes from the FrameworkBundle bundle to the EventDispatcher component.

It makes them reusable outside the Symfony full-stack framework as they can be quite useful (people like @drak has a use for them for instance).

It makes the event dispatcher component *optionally* rely on DependencyInjection and HttpKernel for these classes, like what we have in other components.

What do you think?

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

by stof at 2012-04-02T16:02:01Z

you forgot to update the ``suggests`` section of the composer.json file. Otherwise, it is fine

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

by drak at 2012-04-02T16:06:34Z

w00t, thanks @fabpot!

I'm biased of course, but the optional dependency to `DependencyInjection` is a much more logical dependency that the previous one, to `FrameworkBundle`. It immediately shows of the DIC also.

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

by schmittjoh at 2012-04-02T16:06:39Z

+1, the "no dependencies" should really be changed to "minimal dependencies"

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

by henrikbjorn at 2012-04-02T16:09:48Z

@schmittjoh should properly be "minimal optional dependencies" otherwise people will be scared i think :) And reading "minimal dependencies" reminds me when trying to use a zf1 component standalone.

+1

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

by drak at 2012-04-02T16:12:57Z

@schmittjoh Honestly speaking, some of the Sf2 components do already have a few dependencies with each other, but where there are, they all minimal and rather logical anyway.  It's not like some libraries I could mention where one lib required about 10 deps which each rely on a bunch of other things - in the end, you need everything just for one feature :-P

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

by stof at 2012-04-02T16:14:28Z

@drak there was not optional dependency to FrameworkBundle previously as no code of the component was using FrameworkBundle (the dependency was the other way)

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

by drak at 2012-04-02T16:18:31Z

@stof, yeah but I was talking about other components like Security, DependencyInjection, HttpKernel for example which has a mix of optional and required deps.  It's not true to say all Sf2 components are 100% standalone in all cases.
2012-04-02 18:29:43 +02:00
Fabien Potencier
93848be93b moved event dispatcher classes to the EventDispatcher component 2012-04-02 18:28:49 +02:00