Commit Graph

9227 Commits

Author SHA1 Message Date
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
Christophe Coevoet
dbab7e1ef6 [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.
2012-04-02 18:28:35 +02:00
Fabien Potencier
275267f4f8 merged branch eriksencosta/cs-fixes (PR #3757)
Commits
-------

2cac50d fixed CS (missing or misplaced license blocks)

Discussion
----------

fixed CS (missing or misplaced license blocks)
2012-04-02 09:06:33 +02:00
Eriksen Costa
2cac50d8a9 fixed CS (missing or misplaced license blocks) 2012-04-02 00:52:14 -03:00
Christophe Coevoet
eae772e480 [ClassLoader] Added an ApcClassLoader
Unlike the ApcUniversalClassLoader, ApcClassLoader uses composition,
meaning it can be used to wrap any object providing a findFile($class)
method. Both the UniversalClassLoader and the new ClassLoader follow
this convention. It can also be used to wrap the Composer autoloader.
2012-04-01 23:56:45 +02:00
Christophe Coevoet
4d1333fa4f Changed the test autoloading to use the new autoloader 2012-04-01 23:50:54 +02:00
Christophe Coevoet
09850bdf01 [ClassLoader] Added a simplified PSR-0 ClassLoader
The new ClassLoader does not differentiate namespaced classes and
PEAR-like classes like the UniversalClassLoader does as the PEAR
format is a subset of PSR-0.
The new loader registers fallbacks by adding a location for an empty
prefix, as done in Composer. This allows using namespaces map generated
by Composer without any special processing on them.
2012-04-01 23:31:48 +02:00
Fabien Potencier
d6330e1bb3 merged branch havvg/hotfix/propel-modelchoice-readonly-models (PR #3731)
Commits
-------

64c7183 clean file docs in Propel1 fixtures
97ba218 accept read-only models in ModelChoiceList

Discussion
----------

accept read-only models in ModelChoiceList

Ping @willdurand

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

by willdurand at 2012-03-30T08:57:14Z

👍
2012-04-01 10:36:33 +02:00
Fabien Potencier
5821abb732 merged branch ruimarinho/sort_by_time (PR #3745)
Commits
-------

dcf82d7 [Finder] Added sortBy options based on accessed, changed and modified times

Discussion
----------

[Finder] Added sortBy options based on accessed, changed and modified times

Bug fix: no
Feature addition: yes
Backwards compatibility break: no
Symfony2 tests pass: yes
2012-04-01 10:35:33 +02:00
Fabien Potencier
e92994ce3e merged branch lsmith77/HttpFoundation_test (PR #3744)
Commits
-------

925b65d updated reference to tests

Discussion
----------

updated reference to tests

this is basically the format used in all other components.

however i am not sure if it really makes sense to list ``phpunit -c src/Symfony/Component/HttpFoundation/``, since this relative path could be confusing for anyone using the standalone components. But even if using ``symfony/symfony`` the path is wrong relative to the location of the README.md.
2012-04-01 10:33:44 +02:00
Fabien Potencier
452e79512b merged branch eriksencosta/cs-fixes (PR #3750)
Commits
-------

cf67870 fixed line break to LF
013f998 updated license blocks
bec231f fixed CS

Discussion
----------

fixed CS
2012-04-01 10:29:17 +02:00
Fabien Potencier
a10fee16c1 merged branch igorw/dic-yaml-without-args (PR #3747)
Commits
-------

24a0d0a [DependencyInjection] Support Yaml calls without arguments

Discussion
----------

[DependencyInjection] Support Yaml calls without arguments
2012-04-01 10:27:21 +02:00
Eriksen Costa
cf67870af7 fixed line break to LF 2012-03-31 18:11:43 -03:00
Eriksen Costa
013f998bb8 updated license blocks 2012-03-31 18:00:32 -03:00
Eriksen Costa
bec231f6ca fixed CS 2012-03-31 17:31:37 -03:00
Rui Marinho
8689e9cbf2 [WIP] [Locale] Fixes NumberFormatter tests failing when using ICU 4.8 or 4.8.1 2012-03-31 21:16:46 +01:00
Igor Wiedler
24a0d0a2dc [DependencyInjection] Support Yaml calls without arguments 2012-03-31 21:11:13 +02:00
Rui Marinho
dcf82d732b [Finder] Added sortBy options based on accessed, changed and modified times 2012-03-31 19:48:43 +01:00
Drak
8a0e6d24bc [HttpFoundation] Update changelog. 2012-03-31 22:37:01 +05:45
Drak
4fc04fae18 [HttpFoundation] Renamed MetaBag to MetadataBag 2012-03-31 22:36:52 +05:45
lsmith77
925b65dbaf updated reference to tests 2012-03-31 15:56:35 +02:00
Drak
2f03b31258 [HttpFoundation] Added the ability to change the session cookie lifetime on migrate().
This is a very important option which allows the cookie lifetime to be changed on migrate.
For example when a user converts from an anonymous session to a logged in session one might
wish to change from a persistent cookie to browser session (e.g. a banking application).
2012-03-31 19:12:26 +05:45
Drak
39141e865b [HttpFoundation] Add ability to force the lifetime (allows update of session cookie expiry-time) 2012-03-31 19:12:22 +05:45
Drak
ec3f88f339 [HttpFoundation] Add methods to interface 2012-03-31 19:12:18 +05:45
Drak
402254ca7e [HttpFoundation] Changed meta-data responsibility to
SessionStorageInterface

Added cookie_lifetime to the meta-data.  This allows to know how old
a cookie is and when the cookie will expire.
2012-03-31 19:12:13 +05:45
Drak
d9fd14f261 [HttpFoundation] Refactored for moved tests location. 2012-03-31 19:12:08 +05:45
Drak
29bd787b7e [HttpFoundation] Added some basic meta-data to Session
This commit allows applications to know certain meta-data about the session
Session storage is designed to only store some data against a session ID
so this method is necessary to be compatible with any session handler, including
native handlers.
2012-03-31 19:12:04 +05:45
Fabien Potencier
0c7b2911bc [Routing] removed code that was not ready to be pushed 2012-03-30 20:36:59 +02:00
umpirsky
f91660db9c Added test for prototype label. 2012-03-30 15:35:41 +02:00
Fabien Potencier
5178e76d4e merged branch drak/sessionarray (PR #3735)
Commits
-------

8dd2c27 [HttpFoundation] Further micro-optimization.
54c5d5e [HttpFoundation] Micro-optimisation.

Discussion
----------

[HttpFoundation] Micro-optimisation.

Ref #3729

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

by robocoder at 2012-03-30T11:45:02Z

If you pre-flip your $validOptions arrays, you can use isset() instead of in_array() in the loop.

This changes the performance from O(m * n) to O(m).

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

by drak at 2012-03-30T11:53:24Z

@robocoder What is the expense of the array_flip though?

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

by robocoder at 2012-03-30T11:56:21Z

Why would you use array_flip if the array doesn't change?  Change $validOptions = array('x', 'y', ...) to $validOptions = array('x' => 0, 'y' => 0, ...), then change the in_array() to use isset().

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

by stof at 2012-03-30T11:57:08Z

@drak a loop. But it will be done only once before the other loop so it will be O(n + m) instead of O(m * n)

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

by drak at 2012-03-30T12:00:47Z

Ok :)
2012-03-30 14:05:19 +02:00
Fabien Potencier
b03d107fe6 merged branch vicb/component_tests (PR #3736)
Commits
-------

234ce4d [PhpUnit] Fix the path to the boostrap files in the components

Discussion
----------

[PhpUnit] Fix the path to the boostrap files in the components
2012-03-30 14:00:14 +02:00
Drak
8dd2c273d3 [HttpFoundation] Further micro-optimization. 2012-03-30 17:41:58 +05:45
Victor Berchet
234ce4df9e [PhpUnit] Fix the path to the boostrap files in the components 2012-03-30 13:49:28 +02:00
Drak
54c5d5ed32 [HttpFoundation] Micro-optimisation. 2012-03-30 17:22:48 +05:45
Toni Uebernickel
64c7183bf5 clean file docs in Propel1 fixtures 2012-03-30 10:53:43 +02:00
Toni Uebernickel
97ba2189c9 accept read-only models in ModelChoiceList 2012-03-30 10:49:44 +02:00