Commit Graph

7840 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
Fabien Potencier
e18fcd852a merged branch kbond/extensible-httpcache (PR #3716)
Commits
-------

8f11f2dd shortened if/else syntax
2b8c2bc [FrameworkBundle] made http_cache dir extensible

Discussion
----------

[FrameworkBundle] make http_cache dir extensible

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

I have a use case where I don't want the httpcache cleared on `cache:clear`.  Currently, it is awkward to change this directory.

[![Build Status](https://secure.travis-ci.org/kbond/symfony.png?branch=extensible-httpcache)](http://travis-ci.org/kbond/symfony)
2012-03-30 08:10:12 +02:00
Oscar Cubo Medina
aac6ad8018 [Console] avoid warning parsing empty string argument 2012-03-29 21:02:51 +02:00
Fabien Potencier
a7a696fc5a merged branch liuggio/webtestcase_kernel_shutdown_before_client (PR #3704)
Commits
-------

3303155 added kernel shutdown before create client, fixed and stashed

Discussion
----------

[FrameworkBundle] WebTestCase createClient doesn't check if static:kernel was already allocated

with this little fix CreateClient shuts down the kernel before booting again.

If you add an echo after the "if" on the line number 38
and run the test you would see that sometime the kernel is not properly umounted.

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

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

by fabpot at 2012-03-29T09:19:07Z

Can you squash your commits before I merge? Thanks.

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

by liuggio at 2012-03-29T10:17:59Z

Done.
2012-03-29 15:32:24 +02:00
Fabien Potencier
036fc36919 merged branch lyrixx/patch-1 (PR #3721)
Commits
-------

c73748f [HttpFoundation] Added RFC reference to 308
468ad40 [HttpFoundation] Added support for 308 / Permanent Redirect

Discussion
----------

[HttpFoundation] Added support for 308 / Permanent Redirect

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

I know this is still a draft, but it is already implemented in Firefox.

See :

- http://tools.ietf.org/html/draft-reschke-http-status-308-07
- https://developer.mozilla.org/en/HTTP/HTTP_response_codes#308

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

by stloyd at 2012-03-29T09:25:20Z

It will be in Firefox... 14!

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

by fabpot at 2012-03-29T09:33:01Z

Like the non RFC 2616 status code, you need to add the RFC number as a comment (or the reference to the draft).

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

by lsmith77 at 2012-03-29T11:58:14Z

can you open a PR for https://github.com/FriendsOfSymfony/FOSRest/blob/master/Util/Codes.php ?

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

by lyrixx at 2012-03-29T12:08:31Z

@lsmith77 : Done. See : https://github.com/FriendsOfSymfony/FOSRest/pull/7 :)
2012-03-29 14:54:38 +02:00
Martin Hasoň
44a7ca1733 [FrameworkBundle] added new czech validators translations for the File constraint. 2012-03-29 14:37:47 +02:00
Clemens Tolboom
e4f3fd9a72 Fixed example code. 2012-03-29 14:32:59 +02:00
Shein Alexey
0bde12c6c0 Added some skipifs to prevent fatal errors on missing extensions. 2012-03-29 15:19:53 +05:00
Grégoire Pineau
c73748fd22 [HttpFoundation] Added RFC reference to 308 2012-03-29 12:05:33 +02:00
Giulio De Donato
3303155023 added kernel shutdown before create client, fixed and stashed 2012-03-29 11:34:12 +02:00
Grégoire Pineau
468ad40405 [HttpFoundation] Added support for 308 / Permanent Redirect 2012-03-29 12:18:49 +03:00
Fabien Potencier
b1bb27e8da merged branch havvg/master (PR #3700)
Commits
-------

dd4d46a add limit to logger explosion

Discussion
----------

add limit to logger explosion

This limit is required to display complete query with e.g. "array" type in it.

ping @willdurand
2012-03-29 08:57:31 +02:00
Fabien Potencier
13a27ed73a merged branch robocoder/patch-1 (PR #3701)
Commits
-------

33382cd Add exception-controller attribute to xsd

Discussion
----------

Add exception-controller attribute to xsd
2012-03-29 08:56:32 +02:00
Fabien Potencier
7c59d8d490 merged branch ajessu/phpserver (PR #3717)
Commits
-------

d243097 Run built-in server on dev environment

Discussion
----------

Run built-in server on dev environment

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

Change the router of the built-in server command to run on dev environment.

The symfony standard edition doesn't have any `/` route by default (it's only available to dev), so by default, when ran, it gives a `404`, unless you explicitely add the `app_dev.php` front controller to the route.

Also, this server is meant to be run on dev only, so no need to run it with the prod front controller by default.
2012-03-29 08:48:13 +02:00
Fabien Potencier
d471a16657 merged branch drak/flashinterface (PR #3719)
Commits
-------

cde1c52 [HttpFoundation] Add missing method in flash interface.

Discussion
----------

[HttpFoundation] Add missing method in flash interface.

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: #3711
Todo: -
2012-03-29 08:46:07 +02:00
Fabien Potencier
aed954cb63 fixed typo in the previous commit 2012-03-29 08:41:52 +02:00
Fabien Potencier
fea6b79acd moved component and bridge unit tests to the src/ directory
This is the first step to make each Symfony Component and Bridge self-contained.
2012-03-29 08:37:22 +02:00
Drak
cde1c52914 [HttpFoundation] Add missing method in flash interface. 2012-03-29 05:21:43 +05:45
Albert Jessurum
d24309789c Run built-in server on dev environment 2012-03-29 00:43:09 +02:00
Fabien Potencier
3e95126437 [DomCrawler] removed the hard dependency on CssSelector 2012-03-28 18:08:10 +02:00
Kevin Bond
8f11f2dd30 shortened if/else syntax 2012-03-28 11:52:41 -04:00
Kevin Bond
2b8c2bc9c3 [FrameworkBundle] made http_cache dir extensible 2012-03-28 11:41:21 -04:00
Jordan Alliot
15dd17e9bd Simplified CONTENT_ headers retrieval 2012-03-26 23:58:48 +02:00
Fabien Potencier
1bb6e0de4d merged branch drak/session_gc (PR #3659)
Commits
-------

cdba4cf [FrameworkBundle] Change XSD to allow string replacements on session args.
52f7955 [FrameworkBundle] Remove default from gc_* session configuration keys.
749593d [FrameworkBundle] Allow configuration of session garbage collection for session 'keep-alive'.

Discussion
----------

[2.1][FrameworkBundle] Allow configuration of session garbage collection

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

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

by drak at 2012-03-21T21:56:20Z

@fabpot - this PR is ready for merge.  It basically allows configuration of some session ini values that are necessary in controlling the session behaviour.

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

by dlsniper at 2012-03-21T22:57:18Z

@drak shouldn't all the options here: https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php#L266 be available for configuration, or am I just reading the source wrong and they already are?

In this case should I make a separate PR to cover the rest or could you do it in this one?

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

by fabpot at 2012-03-23T14:56:22Z

@drak: the discussion is the ticket is very interesting and I think it should be part of a cookbook in the documentation. Can you take care of that before I merge this PR? Thanks.

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

by drak at 2012-03-25T15:32:59Z

@fabpot - yes - it's on the todo list.  Will update this PR when done.

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

by drak at 2012-03-26T19:45:13Z

@fabpot - this is ready for merging, the documentation is done (the PR is in but I'll tweak it, but no need to wait to merge this PR).  I will also add something extra to cookbook (I wrote docs for the component).
2012-03-26 22:08:10 +02:00
Anthon Pang
33382cd4f4 Add exception-controller attribute to xsd 2012-03-26 13:17:28 -03:00
Toni Uebernickel
dd4d46a4c7 add limit to logger explosion
This limit is required to display complete query with e.g. "array" type in it.
2012-03-26 17:07:55 +02:00
Fabien Potencier
cd56d09012 merged branch cedriclombardot/feat-propel-explain (PR #3616)
Commits
-------

9ef5e95 Add connection name in the propel data collector

Discussion
----------

Add connection name in the propel data collector

Bug fix: no
Feature addition: yes, This will allow to explain a propel query on a specific connection
Backwards compatibility break: no
Symfony2 tests pass: yes

- Require PR propelorm/Propel#315
- Related to PR propelorm/PropelBundle#129

cc @willdurand

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

by willdurand at 2012-03-16T18:17:26Z

@fabpot please, let me merge Propel related PRs before that one, thanks!

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

by willdurand at 2012-03-26T08:38:36Z

@fabpot good to go from my point of view
2012-03-26 10:39:42 +02:00
Fabien Potencier
74b7bb3605 merged branch gatsu/patch-1 (PR #3689)
Commits
-------

b718960 HttpFoundation\HeaderBag Little improvement.

Discussion
----------

[HttpFoundation\HeaderBag] Removed unnecessary anonymous function

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

by vicb at 2012-03-24T16:07:00Z

Related issue: #3294
2012-03-26 09:47:20 +02:00
Fabien Potencier
1aaf5c9423 merged branch marcw/patch-security-refresh-user (PR #3402)
Commits
-------

10947cb [DoctrineBridge][Security] Fixes bug that prevents repository's refreshUser from being called

Discussion
----------

[Security][DoctrineBridge] Fixes bug that prevents repository's refreshUser from being called

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

by marcw at 2012-02-21T08:46:09Z

Updated. What do you guys think about this patch ?

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

by henrikbjorn at 2012-02-21T08:57:47Z

Isnt this a bit dangerous, the custom repository implementing refreshUser should always be called first right? You wouldnt specify the $property property if your class has custom implementations would you?

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

by marcw at 2012-02-21T09:05:08Z

@henrikbjorn At this time, the refreshUser method is never called from the custom repository, even if you don't specify the "property" property. This patch fixes this.

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

by marcw at 2012-02-21T09:44:06Z

Updated & Squashed.

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

by stof at 2012-02-21T10:03:33Z

@marcw please move the retrieval of the id in the ``else`` block, like in my comment as it is useless to do this logic for the case where the userProviderInterface is implemented (and it will answer to @vicb by making it impossible to write it with elseif)

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

by marcw at 2012-02-21T10:19:06Z

I'm not sure about this, but Isn't the check of the id essential here to ensure that the entity is a persisted one ?

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

by stof at 2012-02-21T10:21:55Z

@marcw if the interface is used, it means that the user wants to do the work himself. So you should really let him do the way he wants. If he does not use the id to refresh the user, he could choose not to include it in the serialized data.
Retrieving the id is needed for the ``find()`` call because we pass the id as argument and so we fail when the serialized data don't contain it

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

by marcw at 2012-02-21T10:33:30Z

@stof Roger that. I'll do the fix.

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

by marcw at 2012-02-21T10:41:58Z

Updated & Squashed, again.

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

by stof at 2012-02-21T11:00:44Z

btw, to answer to your previous question, the exception when retrieving the id does not check if the object is persisted (you need to reach teh DB for this, which is what find() does) but that the id is part of the serialized data to give a better error reporting.

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

by fabpot at 2012-03-07T19:39:33Z

ready to be merged now?

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

by henrikbjorn at 2012-03-08T07:21:37Z

would say so.

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

by dlsniper at 2012-03-25T11:58:34Z

Hi, can this be merged now or not?
2012-03-26 09:36:13 +02:00
Jordi Boggiano
86a3512bd4 [FrameworkBundle] Add support for full URLs to redirect controller 2012-03-25 20:43:23 +02:00
Artyom Protaskin
b718960857 HttpFoundation\HeaderBag Little improvement. 2012-03-24 11:17:54 +04: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
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
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
5ede11199e merged branch pminnieur/2.0 (PR #3537)
Commits
-------

0c9b2d4 use SecurityContextInterface instead of SecurityContext

Discussion
----------

[2.0][Security] use SecurityContextInterface instead of SecurityContext

see https://github.com/symfony/symfony/pull/3522 (this is a fix for the 2.0 branch)

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

by pminnieur at 2012-03-21T13:25:59Z

*ping* it still missed the 2.0.12 release ...

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

by stof at 2012-03-21T16:41:28Z

@pminnieur you PR has been merged into master, not into 2.0, so it will only be in 2.1

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

by pminnieur at 2012-03-21T16:43:02Z

I know, and this is a second PR for 2.0 branch.
2012-03-23 13:49:58 +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
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
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
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
aubx
d42ae470ec Added Croatian validator translation for 2.0 2012-03-22 19:57:58 +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
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
Drak
cdba4cf685 [FrameworkBundle] Change XSD to allow string replacements on session args. 2012-03-22 03:39:32 +05:45
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
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
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
Joe Lencioni
068e859f3d [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.
2012-03-21 15:25:48 -05:00
Fabien Potencier
9cdc9712b0 merged branch vicb/form/guess/length (PR #3645)
Commits
-------

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

Discussion
----------

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

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

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

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

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

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

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

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

Will `strlen` works correctly with multibyte strings?

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

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

could numeric types be multibyte strings ?

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

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

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

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

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

This PR is about numeric types only and the MaxLengthValidator is [multibyte safe:](https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Validator/Constraints/MaxLengthValidator.php#L45)
2012-03-21 18:41:37 +01:00
Julien Brochet
93d2a4f039 [Translation] Ignore xliff entries with no "target" node 2012-03-21 14:55:53 +01:00
Drak
52f7955416 [FrameworkBundle] Remove default from gc_* session configuration keys. 2012-03-21 12:53:00 +05:45
Tobias Schultze
11585c3b67 fix Command:asXml to use processed help 2012-03-21 05:32:51 +01:00
Tobias Schultze
304e13daa3 replaced command names with supported placeholders in help texts 2012-03-21 05:31:52 +01:00
Drak
749593d1c3 [FrameworkBundle] Allow configuration of session garbage collection for session 'keep-alive'. 2012-03-21 09:22:46 +05:45
Fabien Potencier
efa807aa7b [HttpKernel] fixed sub-request which should be always a GET (refs #3657) 2012-03-21 00:31:28 +01:00
Alexander
c1206c33c2 [FrameworkBundle] Subrequests should always use GET method 2012-03-20 23:59:34 +01:00
Florin Patan
a09deca5da [Validator] Updated Romanian translation 2012-03-21 00:50:04 +02:00
Toni Uebernickel
601b87ca01 add basic validation of callback name 2012-03-20 11:05:22 +01:00
Toni Uebernickel
266f76d963 rename jsonp to callback, defaults to null 2012-03-20 10:10:35 +01:00
Victor Berchet
fc7c7f6458 [Form] Fix min/max length guessing for numeric types (fix #3091) 2012-03-19 23:57:21 +01:00
Rafael Dohms
836d12b660 Fixing typo. 2012-03-19 23:29:43 +01:00
aubx
e95ef75015 Added Croatian translation of validator 2012-03-19 20:37:53 +01:00
Toni Uebernickel
38b79a7023 add data and callback setter to JsonResponse 2012-03-19 19:40:54 +01:00
Toni Uebernickel
678822459b add JSONP support to JsonResponse 2012-03-19 18:29:39 +01:00
Fabien Potencier
05c523a7de removed obsolete phpdoc 2012-03-19 16:13:52 +01:00
Rafael Dohms
ac2a187b4d Improved feedback for Upload Validator to cover all PHP error states.
This way we don't get a unclear "upload error" message unless its something completely unexpected.
2012-03-19 14:37:25 +01:00
Johannes M. Schmitt
57de69f3bf added an exception for failed processes 2012-03-18 21:51:31 -06:00
Johannes M. Schmitt
3f2b9176e6 added a configurable extension base class 2012-03-18 21:15:55 -06:00
Fabien Potencier
f11f7fcbe0 bumped Symfony version to 2.0.13-DEV 2012-03-19 01:27:26 +01:00
Fabien Potencier
0ab776227a updated VERSION for 2.0.12 2012-03-19 00:57:46 +01:00
Fabien Potencier
645d09c984 merged branch jmikola/double-dash (PR #3624)
Commits
-------

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

Discussion
----------

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

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

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

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

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

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

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

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

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

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

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

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

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

8642473 Changed instances of \DateTimeZone::UTC to 'UTC' as the constant is not valid a produces this error when DateTimeZone is instantiated: DateTimeZone::__construct() [<a href='datetimezone.--construct'>datetimezone.--construct</a>]: Unknown or bad timezone (1024)

Discussion
----------

[Locale] DateTimeZone called incorrectly by default

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: no (there were two tests that were failing previously, that still fail)
Fixes the following tickets: none
Todo: none

While running, a warning throws every single time when the code

```php
new \DateTimeZone(\DateTimeZone::UTC);
```
is encountered. It is normally caught as a thrown exception and then corrected here:

```php
// src/Symfony/Component/Locale/Stub/StubIntlDateFormatter.php:442
        try {
            $this->dateTimeZone = new \DateTimeZone($timeZoneId);
        } catch (\Exception $e) {
            $this->dateTimeZone = new \DateTimeZone('UTC');
        }
```

However in my particular infrastructure, for whatever reason in production only, it causes an error to appear on shutdown in the logs. As ultimately the constant can NEVER pass, it should not be attempted with the constant. Instead, the correct 'UTC' should be passed in (as done in the catch statement).
2012-03-17 09:45:14 +01:00
Fabien Potencier
aad7d6e758 merged branch pulzarraider/webprofiler_serch_ipv6_fix (PR #3626)
Commits
-------

54b2413 Webprofiler ipv6 search fix

Discussion
----------

[WebProfilerBundle] ipv6 search fix

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: -
Todo: -
2012-03-17 09:41:12 +01:00
Fabien Potencier
3d84153d68 merged branch pulzarraider/session_doc_fix (PR #3627)
Commits
-------

f351cdc doc fix

Discussion
----------

[HttpFoundation] documentation fix

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: -
Todo: -
2012-03-17 09:40:25 +01:00
Andrej Hudec
f351cdc52c doc fix 2012-03-17 00:59:57 +01:00
Andrej Hudec
c4ee947a83 Native Redis Session Storage update 2012-03-17 00:17:36 +01:00
Andrej Hudec
665f59348b NativeRedisSessionStorage added
- fix and simple unit test added
2012-03-17 00:17:33 +01:00
Victor Berchet
99406eb761 Update src/Symfony/Component/Validator/Mapping/ClassMetadataFactory.php 2012-03-16 23:38:13 +01:00
Andrej Hudec
54b24134e8 Webprofiler ipv6 search fix 2012-03-16 22:52:43 +01:00
Drew Butler
8642473185 Changed instances of \DateTimeZone::UTC to 'UTC' as the constant is not valid a produces this error when DateTimeZone is instantiated: DateTimeZone::__construct() [<a href='datetimezone.--construct'>datetimezone.--construct</a>]: Unknown or bad timezone (1024) 2012-03-16 17:19:53 -04:00
Jeremy Mikola
4d4ef24c47 [Console] Stop parsing options after encountering "--" token
This enables support for arguments with leading dashes (e.g. "-1"), as supported by getopt in other languages.
2012-03-16 15:53:13 -04:00
Jean-François Simon
2a908711cd [Console] Removed previously introduced BC break. 2012-03-16 14:00:53 +01:00
Fabien Potencier
91e977d38c fixed CS for previous merge 2012-03-16 13:29:17 +01:00
clombardot
9ef5e95984 Add connection name in the propel data collector
This will allow to explain a propel query on a specific connection
2012-03-16 12:45:18 +01:00
Rafael Dohms
2c4a43d91d Made option to use symlink explicit in the output. This can clear up any issues for example when running composer update to know if assets:install did a symlink or hard copy.
On a general it just makes communication a bit clearer on what is being executed.
2012-03-16 12:37:18 +01:00
Jean-François Simon
90a2a6e556 [Console] Undecorated formatter must update style stack too. 2012-03-16 10:22:20 +01:00
Jean-François Simon
a1add4b8d5 [Console] Updated output formatter to use style stack. 2012-03-16 09:44:39 +01:00
Jean-François Simon
4f298dd7c7 [Console] Added formatter style stack. 2012-03-16 09:39:23 +01:00
Jean-François Simon
93ffe54886 [Console] Added getters to output formatter style (and its interface). 2012-03-16 09:09:42 +01:00
Jean-François Simon
ad334b68a3 [Console] Fixed empty style appliance. 2012-03-16 07:29:46 +01:00
Jean-François Simon
31d5fe58fe [Console] Fixed output formatter docblock. 2012-03-16 07:27:13 +01:00
Chris Boden
bd02554289 [HttpFoundation] SPL IteratorAggregate+Countable on *Bags
Added the IteratorAggregate and Countable SPL Interfaces on all the *Bag classes in HttpFoundation
2012-03-15 16:41:06 -04:00
Arnaud Buathier
fbed9ff8de Update src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php 2012-03-15 20:27:40 +01:00
Fabien Potencier
5631002cd0 merged branch Seldaek/chainableresp (PR #3606)
Commits
-------

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

Discussion
----------

Chainable response

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

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

Discussion
----------

Chainable responses

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

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

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

+1
2012-03-15 17:39:12 +01:00
Fabien Potencier
120c2a260f merged branch vicb/twig/form_theme (PR #3576)
Commits
-------

0c83c5d [Form] Alternate syntax for form_theme

Discussion
----------

[RFC][Form] Alternate syntax for form_theme

before
`{% form_theme form _self "::base.html.twig" %}`

after
`{% form_theme form with "::base.html.twig" %}`
`{% form_theme form with varTheme %}`
`{% form_theme form with [_self, "::base.html.twig"] %}`

_the former syntax is still supported_

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

by stof at 2012-03-12T15:42:32Z

do you really need ``with`` ?

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

by vicb at 2012-03-12T15:50:41Z

it's not needed but I find it more clear (It can be drop if a consensus is reached)

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

by fabpot at 2012-03-12T17:05:46Z

+1 for `with`. Documentation for master should be updated as well.

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

by Tobion at 2012-03-13T02:26:22Z

+1 for `with`, but the syntax without array like `{% form_theme form with "::base.html.twig" %}` should also be supported

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

by vicb at 2012-03-13T07:16:55Z

`[]` are nice as they clearly indicate the ability to use multiple themes (which I think is yet to be documented). We'll pick the most popular syntax only.

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

by stof at 2012-03-13T08:16:40Z

@vicb supporting a string instead of an array should be possible when you need only one element. supporting several ones and turning it into an array is the mistake we made for 2.0

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

by hhamon at 2012-03-13T08:16:45Z

+1 for the new syntax

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

by vicb at 2012-03-13T08:29:45Z

@stof @Tobion what about using the former syntax then ?

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

by Baachi at 2012-03-13T08:32:09Z

+1 for new syntax. But it should be possible to use strings instead of arrays.

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

by stof at 2012-03-13T08:33:07Z

@vicb Having one wyntax using ``with`` and the other without will confuse users IMO. this is why I suggested allowing to pass a Twig array without adding an extra word

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

by stof at 2012-03-13T08:40:02Z

@Baachi not stringS as it is precisely what we are trying to solve :)

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

by Baachi at 2012-03-13T08:42:03Z

Oh sry. I mean __string__. :)

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

by fabpot at 2012-03-13T11:16:30Z

+1 for supporting a string or an array with the new syntax as using only one element is probably the most common use case. But then, why not supporting any valid Twig expression?

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

by vicb at 2012-03-13T11:54:51Z

Something like the latest commit ? (Tests have to be updated).

@fabpot What is the best place to handle array / non-array ? This is currenlty handled in the node but the parser might be a better place.

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

by fabpot at 2012-03-13T13:23:08Z

@vicb: I would just remove the special array case in the node as it's not needed anymore.

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

by fabpot at 2012-03-13T13:24:15Z

... and update FormExtension::setTheme() to also accept a string in which case we convert it to an array there.

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

by schmittjoh at 2012-03-13T14:26:17Z

I'd prefer a named argument instead of an ubiquitous "with" keyword which does not really tell me what's coming next.

Something like ``{% form_theme _form templates=[a, b, c] %}``. This is pretty nicely done for the assetic tags "javascripts", and "stylesheets".

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

by Tobion at 2012-03-13T16:04:26Z

@schmittjoh it would only make sense if there are multiple named arguments. With only one available it seems redundant.
Also `{% form_theme _form templates="template.html.twig" %}` is bad.

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

by vicb at 2012-03-14T07:59:08Z

I tend to agree with @Tobion but I'll have a closer look at assetic to see if we can make things more consistent.

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

by Seldaek at 2012-03-14T10:36:15Z

This would be more consistent with assetic, but assetic isn't really consistent with anything else in twig, although I see the benefits in that particular case for swapping and omitting parameters.

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

by schmittjoh at 2012-03-14T15:49:37Z

My goal was not really consistency, but I simply find it more obvious,
self-explanatory and easier to understand if you name things explicitly. We
are using the "with" keyword in several places and each time something
different is expected.

To me explicit naming is superior, but just my 2c

On Wed, Mar 14, 2012 at 4:36 AM, Jordi Boggiano <
reply@reply.github.com
> wrote:

> This would be more consistent with assetic, but assetic isn't really
> consistent with anything else in twig, although I see the benefits in that
> particular case for swapping and omitting parameters.
>
> ---
> Reply to this email directly or view it on GitHub:
> https://github.com/symfony/symfony/pull/3576#issuecomment-4495732
>

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

by Tobion at 2012-03-14T16:48:01Z

When I first saw this tag I didn't understand the role of first parameter.
So if we use johannes suggestion it should rather be `{% form_theme form=myForm templates=[a, b, c] %}`

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

by mvrhov at 2012-03-14T18:09:09Z

Before we complicate this any further can I add another thing here.
Moving to dedicated issue: Inflexible form theming #3598

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

by vicb at 2012-03-14T18:20:54Z

@mvrhov that is not the good place to discuss this (both this particular issue and GH as this is a support request).

_Have you tried `{% form_theme form.subForm ... %}`_

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

by vicb at 2012-03-15T07:39:14Z

Where do you think we should go:

1. `{% form_theme form with [_self, "::base.html.twig"] %}`
2. `{% form_theme form=form src=[_self, "::base.html.twig"] %}`

Let's discuss the structure first & not the details (i.e. src vs templates).

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

by Baachi at 2012-03-15T07:52:51Z

I tend to ```{% form_theme form with [_self, "::base.html.twig"] %}```, because its more consistent to the twig syntax.

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

by fabpot at 2012-03-15T13:10:56Z

@vicb: I like 1) more than 2) as this how the built-in tags work.

To keep BC even further, can we just remove the `with` keyword? To make it BC, we just need to have a look at extra parameters and add it to an array if they exist.

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

by Tobion at 2012-03-15T13:19:52Z

For newcomers 2) is definitely easier to understand. But it would also only make sense if you can change the parameter order, so `{% form_theme form=form src=[_self, "::base.html.twig"] %}` == ` {% form_theme src=[_self, "::base.html.twig"] form=form %}`. At the same time it reduces consistency. So for experienced developers option 1) [without "with"] is less redundant and preferable.

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

by vicb at 2012-03-15T13:53:49Z

@fabpot removing the `with` will make `Parser::parsePostfixException()` scream when providing an array of themes.
2012-03-15 16:54:08 +01:00
Fabien Potencier
0aac3613e1 merged branch jankramer/master (PR #3478)
Commits
-------

e6577de Added a 'post validation' event to the form component.

Discussion
----------

[Form] Add post-validate event

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

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

by fabpot at 2012-03-02T20:34:18Z

ping @bschussek

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

by vicb at 2012-03-04T09:19:53Z

I think this is a good idea (It was something missing to properly handle PersistentFile i.e. you should not persist invalid files)

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

by vicb at 2012-03-09T22:35:26Z

@jankramer please remove the second commit from this PR (see http://symfony.com/doc/current/contributing/code/patches.html) in order to make this mergeable.

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

by jankramer at 2012-03-10T09:26:04Z

@vicb done, sorry about that commit: overlooked the fact that it was on the same branch...
2012-03-15 16:46:57 +01:00
Fabien Potencier
5840d05f13 merged branch vicb/twig_cfg/2.0 (PR #3545)
Commits
-------

eee5065 [TwigBundle] Workaround a flaw in the design of the configuration (normalization)

Discussion
----------

[TwigBundle] Workaround a flaw in the design of the configuration (norma...

...lization)

see #2823

@Seldaek please comment.

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

by Seldaek at 2012-03-09T20:52:47Z

It seems fine at first glance. I don't have time to look at it in detail right now sorry.
2012-03-15 16:42:06 +01:00
Jordi Boggiano
ff13528ad0 [HttpFoundation] Add create method to Json & Redirect responses 2012-03-15 16:28:15 +01:00
Jordi Boggiano
1c86ad78ee [HttpFoundation] Add headers arg to RedirectResponse 2012-03-15 16:27:52 +01:00
Jordi Boggiano
873da434cd [HttpFoundation] Add chainability to the Response class 2012-03-15 16:27:06 +01:00
Fabien Potencier
7a54fe41ca merged 2.0 2012-03-15 15:47:03 +01:00
Fabien Potencier
bbd686a685 merged branch igorw/json-response (PR #3375)
Commits
-------

5fa1c70 [json-response] Add a JsonResponse class for convenient JSON encoding

Discussion
----------

[json-response] Add a JsonResponse class for convenient JSON encoding

Usage example:

    $data = array(user => $user->toArray());
    return new JsonResponse($data);

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

by drak at 2012-02-16T11:51:11Z

@fabpot - maybe we could benefit with a bit more sub-namespacing in this component.  One for Response for example and probably one for Request.

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

by Seldaek at 2012-02-16T15:07:31Z

@drak Please no. Moving the session was already a pain IMO since it was type-hinted in a few places (lack of interface, and interface doesn't include flash stuff still). Creating BC breaks just for fun like that is annoying for interop of bundles. It doesn't matter whether we have 10 or 15 classes in one directory.

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

by drak at 2012-02-17T08:33:46Z

@francodacosta The most optimal place is `__toString()`.

@Saldaek It just looks like the whole namespace is getting more cluttered.  I suggest it because things like Request/Response objects are surely only going to grow over time.  There is always the possibility to make BC for moved and renamed classes so there doesn't have to be any extra complications for making things look cleaner. Anyway, just a thought :-)

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

by stof at 2012-02-17T14:47:40Z

@drak Changing the namespace of a class is a BC break. The request and the response are used in many more places than the Session so it would be a real pain to update this. And the component is tagged with ``@api`` so BC breaks are forbidden without a good reason. The session refactoring was one as it was really an issue in the implementation, but simply renaming the class is not.

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

by fabpot at 2012-03-05T15:03:53Z

I'm -1 for adding this to the core. It does not add much value and why add a special response for JSON and not other formats?

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

by Seldaek at 2012-03-05T18:38:05Z

I think it's useful because it's a class we need in almost every project, and I don't think we're alone. It's super simple but makes me wonder every time why I have to recreate it. I don't want an additional bundle just for 3lines of code. Similarly I would say a JsonpResponse would be great, or maybe just an optional $callback arg to the json response to enable jsonp mode.

I just had someone ask me on irc how to do JSONP so while I think it's obvious and I'm sure you'd think that too, it obviously isn't to newcomers. The Response stuff is hidden behind those render methods & such and people don't realize they can simply subclass. If a few examples were in core it would be both helpful for learning and useful on a day to day basis.

As for other formats, well JSON is typically used nowadays, except when you want more fancy XML APIs, but for that the JMSSerializerBundle + FOSRestBundle are superior and we can't achieve such things in a few lines of code. I could also see a BinaryResponse or DownloadResponse or such that has proper "force-download" headers and accepts any binary stream, but that's another debate.

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

by dragoonis at 2012-03-05T19:43:05Z

I'm +1 for the concept but not commenting on how it should be implemented I'll leave that to other people.

Typically when you want to force a download you have to do ``content-disposition: attachment; filename="filehere.pdf"``
Modifying some response headers and the likes automatically for the user by returning a DownloadResponse object would be very handy..

I'm +1 for @Seldaek's point about examples of sub-classing for specific use cases. It will help with demonstrating how to do custom stuff the right way rather than people coming up with their own contraptions.

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

by stof at 2012-03-05T20:14:39Z

btw, regarding the BinaryResponse, there is a pending PR about it: #2606

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

by simensen at 2012-03-05T21:07:33Z

I'm +1 for providing reference implementations fo custom Response cases. I wanted to find best practices for handling JSONP requests/responses and couldn't find anything at all on the topic. I thought maybe extending Response might be useful but wasn't sure if that could be done safely or should be done at all.

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

by lsmith77 at 2012-03-05T22:28:01Z

@stof i think @drak was suggesting moving the class, but leaving an empty class extending from the new class in the old location to maintain BC

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

by stof at 2012-03-05T23:55:36Z

@lsmith77 This would force Symfony to use the BC class so that it does not break all typehints in existing code

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

by lsmith77 at 2012-03-06T00:22:15Z

BC hacks are never nice .. the goal would just be to eventually have all those classes and more importantly all new ones in a subnamespace. actually it might be easier to just leave all the classes in the old location and create new ones extending from the old ones. anyway .. personally i am also not such a big fan of these specialized responses .. but i guess i see FOSRestBundle as the alternative answer which makes me biased.

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

by Seldaek at 2012-03-06T07:57:36Z

I'm using FOSRestBundle when it's needed, but when you just have a small scale app that needs one or two json responses for specialized stuff it is slightly overkill. And again, newcomers probably won't know about it, and encouraging using it for simple use cases isn't exactly the best learning curve we can provide.

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

by COil at 2012-03-06T23:12:15Z

+1 for this. I have implemented such a function in all my sf1 projects, it will be the same for sf2.

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

by fabpot at 2012-03-15T13:22:27Z

Closing this PR in favor of a cookbook that explains how a developer can override the default Response class (this JSON class being a good example). see symfony/symfony-docs#1159

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

by Seldaek at 2012-03-15T13:25:08Z

Meh. Forcing people to copy paste code from the cookbook in every second project isn't exactly a step forward with regard to ease of use and user-friendliness.

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

by Seldaek at 2012-03-15T13:26:48Z

I mean following this logic, things like the X509 authentication should just be put in cookbooks too because almost nobody needs that. We have tons of code in the framework, I don't get the resistance with adding such a simple class which makes code more expressive.

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

by fabpot at 2012-03-15T13:53:07Z

because X509 authentication is not easy to get it right. Sending a JSON response is as simple as it can get:

    new Response(json_encode($data), 200, array('Content-Type' => 'application/json'));

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

by marijn at 2012-03-15T13:54:25Z

Perhaps we need a `Symfony\Extensions\{Component}` namespace for things that don't necessarily belong in the core but are truly useful...

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

by Seldaek at 2012-03-15T14:03:40Z

I still fail to see why it doesn't belong in core.. There are tons of little helpers here and there, a base controller class made only of proxies, and then this gets turned down because it is simple to do it yourself? Sure it is simple, but it's repetitive and boring too. And while it's simple when you know your way around, some people aren't really sure how to do it.

The whole point of a framework is to avoid repetitive bullshit and be more productive. @fabpot do you have any real arguments against? I can see that you don't see a big use to it, fair enough, but do you see any downside at all?
2012-03-15 15:42:36 +01:00
Xavier Briand
1b395f5351 Revert "Throw exception when "date_widget" option is not equal to "time_widget""
This reverts commit 3c2539fccb.

Conflicts:

	tests/Symfony/Tests/Component/Form/Extension/Core/Type/DateTimeTypeTest.php
2012-03-15 15:32:52 +01:00
Fabien Potencier
c4df57212b merged branch meandmymonkey/switchuser-noexception (PR #3580)
Commits
-------

0e4f789 changed test config
a98d554 [SecurityBundle] Allow switching to the user that is already impersonated (fix #2554)

Discussion
----------

[Security] Disabled exception when switching to the user that is already impersonated

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

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

by vicb at 2012-03-13T14:31:45Z

@meandmymonkey thank you for your work on this issue. Would you have time to add functional tests ?

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

by meandmymonkey at 2012-03-13T14:49:52Z

Probably not today, but during the next few days, yes, of course.

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

by meandmymonkey at 2012-03-14T18:05:19Z

@vicb @schmittjoh Writing the tests I noticed switching to an non-existent user will not raise an exception. While it's not a security issue, it should raise an error for completeness sake, shouldn't it?

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

by vicb at 2012-03-14T20:28:52Z

I think it should (throw an `AuthenticationCredentialsNotFoundException`). _btw there is an extra `sprintf` in the original code that could be remove when attempting to exit_

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

by meandmymonkey at 2012-03-14T21:13:16Z

The problem with throwing an  `AuthenticationCredentialsNotFoundException` (or any other security exception for that matter) is that it derives from `AuthenticationException`, which means it gets caught by the framework and redirects to the login form, which is not what we want in this case.

We need to throw something 500-ish at [L89](d40b3376ec/src/Symfony/Component/Security/Http/Firewall/SwitchUserListener.php (L89)), either a generic or a (new) custom Exception.

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

by meandmymonkey at 2012-03-14T21:43:57Z

IMHO a `LogicException`would be fine, like the one used at [L117](d40b3376ec/src/Symfony/Component/Security/Http/Firewall/SwitchUserListener.php (L117)), as the error is not really about a failed authentication.

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

by vicb at 2012-03-14T21:49:04Z

I agree and btw very good job on the tests !

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

by meandmymonkey at 2012-03-14T22:12:43Z

Thanks :)

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

by vicb at 2012-03-15T08:01:13Z

Could you squash the commits, prefix the commit message with `[SecurityBundle]` and add `(fix #2554)` at the end ?

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

by meandmymonkey at 2012-03-15T08:53:12Z

Done.

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

by vicb at 2012-03-15T09:19:09Z

@fabpot this PR looks good to me.

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

by fabpot at 2012-03-15T12:50:50Z

Tests do not pass when you run them all.

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

by meandmymonkey at 2012-03-15T13:41:45Z

@fabpot @vicb With this config change, they pass when run together.

What is weird though is that the reason seems to be that the config for the profiler gets overwritten when running all tests together, while being used correctly when run alone. Any idea what can cause this? They should be isolated from each other.

The new config from 0e4f789 works, but enables the profiler for all SecurityBundle Tests... which is not strictly necessary.
2012-03-15 14:53:33 +01:00
Andreas Hucks
0e4f789084 changed test config 2012-03-15 14:32:58 +01:00
Fabien Potencier
697befc6e9 [HttpFoundation] updated the list of known mime types based on the Apache HTTPD list (closes #3563) 2012-03-15 14:08:50 +01:00
Miha Vrhovnik
c3dc04a9e8 fixed typos in composer file 2012-03-15 11:15:25 +01:00
Andreas Hucks
a98d554472 [SecurityBundle] Allow switching to the user that is already impersonated (fix #2554)
Disabled exception when switching to the user that is already impersonated, exception is now only thrown when trying to switch to a new user.

Added an Excption exception when switching fails because target user does not exist.

Added funtional tests for switching users.
2012-03-15 01:50:14 -07:00
Drak
910b5c7f83 [HttpFoudation] CS, more tests and some optimization. 2012-03-15 12:15:54 +05:45
Drak
b0466e8bb4 [HttpFoundation] Refactored BC Session class methods.
If code has not be refactored for the new API's then
you would still be using the API with one message per $name.
2012-03-15 12:14:11 +05:45
Drak
84c2e3caf7 [HttpFoundation] Allow flash messages to have multiple messages per type. 2012-03-15 11:55:52 +05:45
Fabien Potencier
85d40686ab merged branch drak/sessionhandler (PR #3493)
Commits
-------

eb9bf05 [HttpFoundation] Remove hard coded assumptions and replace with API calls.
9a5fc65 [HttpFoundation] Add more tests.
68074a2 Changelog and upgrading changes.
7f33b33 Refactor SessionStorage to NativeSessionStorage.
b12ece0 [HttpFoundation][FrameworkBundle] Separate out mock session storage and stop polluting global namespace.
d687801 [HttpKernel] Mock must invoke constructor.
7b36d0c [DoctrineBridge][HttpFoundation] Refactored tests.
39526df [HttpFoundation] Refactor away options property.
21221f7 [FrameworkBundle] Make use of session API.
cb873b2 [HttpFoundation] Add tests and some CS/docblocks.
a6a9280 [DoctrineBridge] Refactor session storage to handler.
a1c678e [FrameworkBundle] Add session.handler service and handler_id configuration property.
1308312 [HttpFoundation] Add and relocate tests.
88b1170 [HttpFoundation] Refactor tests.
2257a3d [HttpFoundation] Move session handler classes.
0a064d8 [HttpFoundation] Refactor session handlers.
2326707 [HttpFoundation] Split session handler callbacks to separate object.
bb30a44 [HttpFoundation] Prepare to split out session handler callback from session storage.

Discussion
----------

[2.1] Support PHP 5.4 \SessionHandler

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

This patch allows us to add services, like an encryption layer into any session handler without having to alter or inherit any code across any session handler, internal or custom.

The `\SessionHandler` class exposes internal PHP's native internal session save handlers like files, memcache, and sqlite by wrapping the internal callbacks through the class giving user-space the chance to intercept, override and filter them by inheriting from `\SessionHandler`.  I've written a pretty nice use-case at http://docs.php.net/sessionhandler which really shows the power of it. I never considered how to make proper use of the `\SessionHandler` in Symfony2 until I wrote the code example you see in that documentation and also because of the `AbstractSessionStorage` base class got in the way.

It's really trivial to enable support for this in Symfony2 but requires to separate out the actual handlers because inheritance is not suitable.

Obviously, the feature will only work with internal PHP-extension provided handlers under PHP 5.4 and will already work in PHP 5.3 with any custom handler (since they all implement `\SessionHandlerInterface`). Symfony2 will also be the first framework to support these amazing features :-D

The necessary changes are really small but beautiful:

The basic idea is this: 1d55d1ff14  removed inheritance and separates out the actual session handler callbacks - the part PHP processes internally.

This is supported by an internal proxy mechanism: 10a36c901e

In terms of BC, not much changes net from 2.0:

  - We can restore the deprecated service ID: `session.storage.native`
  - We add a new service ID `session.handler` (and configuration alias `handler_id`) for the actual session handlers.  This defaults to the renamed `session.handler.native_file` session handler (same behaviour just new name and as it's a default there is no BC break).

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

by fabpot at 2012-03-03T12:15:10Z

Looks good to me. Can you update the CHANGELOG and UPGRADE file accordingly and start to update the documentation at symfony/symfony-docs? Thanks for your work, the session handling in Symfony2 is starting to become amazing!

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

by drak at 2012-03-04T11:09:31Z

@fabpot I will start working on documentation this week and get the CHANGELOG/UPGRADING committed shortly.  I'll ping when done.

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

by drak at 2012-03-14T16:48:37Z

@fabpot - This PR is ready now.
2012-03-15 06:59:41 +01:00
Drak
eb9bf05637 [HttpFoundation] Remove hard coded assumptions and replace with API calls. 2012-03-15 09:51:39 +05:45
Joseph Bielawski
6ad201f5ba [FrameworkBundle + WebProfilerBundle] Optimized images and icons with PunnyPNG 2012-03-14 23:31:48 +01:00
Tiago Ribeiro
ed218bb1b2 Fixed an "Array to string conversion" warning when using PHP 5.4. Also affects Symfony2 master. 2012-03-14 18:05:51 +00:00
Drak
7f33b33aa6 Refactor SessionStorage to NativeSessionStorage.
Native here refers to the fact the session storage interacts with real PHP sessions.
2012-03-14 20:59:57 +05:45
Drak
b12ece0ff7 [HttpFoundation][FrameworkBundle] Separate out mock session storage and stop polluting global namespace.
This makes mock sessions truly mock and not to interfere with global namespace.
Add getters and setters for session name and ID.
2012-03-14 20:32:06 +05:45
Drak
39526df67c [HttpFoundation] Refactor away options property.
It does not make sense to try and store session ini directives since they can be changes outside
of the class as they are part of the global state.

Coding stan
2012-03-14 20:30:05 +05:45
Drak
21221f7cf6 [FrameworkBundle] Make use of session API. 2012-03-14 20:30:05 +05:45
Drak
cb873b250b [HttpFoundation] Add tests and some CS/docblocks. 2012-03-14 20:29:58 +05:45
Drak
a6a9280a3b [DoctrineBridge] Refactor session storage to handler. 2012-03-14 20:27:23 +05:45
Drak
a1c678ecd7 [FrameworkBundle] Add session.handler service and handler_id configuration property.
Revert service back to session.storage.native
Rename session.storage.native_file to session.handler.native_file (which is the default so no BC break from 2.0)
2012-03-14 20:21:40 +05:45
Drak
2257a3d4d6 [HttpFoundation] Move session handler classes. 2012-03-14 20:15:55 +05:45
Drak
0a064d8aa1 [HttpFoundation] Refactor session handlers. 2012-03-14 20:15:51 +05:45
Drak
23267077ff [HttpFoundation] Split session handler callbacks to separate object. 2012-03-14 20:15:48 +05:45
Drak
bb30a447c5 [HttpFoundation] Prepare to split out session handler callback from session storage. 2012-03-14 20:15:44 +05:45
Fabien Potencier
07d2d2e94a merged branch alan0101c/datatransformer-tz-fix (PR #3589)
Commits
-------

17c3482 fixed timezone bug in DateTimeToTimestampTransformer

Discussion
----------

[FIX]fixed timezone bug in DateTimeToTimestampTransformer

After several trials, I found out that the original code

```php
$dateTime = new \DateTime(sprintf("@%s %s", $value, $this->outputTimezone));
```
would create a DateTime object with timezone being '0000', even though $this->outputTimezone is set to my local timezone.

so I expanded the code a bit and it's working now.

PHP Test code,

```PHP
$d = new DateTime("@1234567890 Asia/Tokyo");
echo date_format($d, 'Y/m/d H:i:s')."\n";
echo $d->getTimezone()->getName()."\n";

$d = new DateTime("now Asia/Hong_Kong");
echo date_format($d, 'Y/m/d H:i:s')."\n";
echo $d->getTimezone()->getName()."\n";
```

The output is as followed:
2009/02/13 23:31:30
+00:00
2012/03/13 03:35:55
Asia/Hong_Kong

This could be a bug of PHP,

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

by stealth35 at 2012-03-13T15:54:31Z

👍
2012-03-14 13:07:13 +01:00
Martin Parsiegla
50cb486b67 Fixed proxy generation in the DoctrineBundle when using Doctrine >= 2.2.0 2012-03-14 11:40:15 +01:00
Michał Pipa
df11e6287a [FrameworkBundle] Used $output->write() instead of echo 2012-03-13 18:54:56 +01:00
Victor Berchet
0c83c5d594 [Form] Alternate syntax for form_theme 2012-03-13 14:48:30 +01:00
Toni Uebernickel
235be43cd3 fix PropelLogger stopwatch events 2012-03-13 14:42:19 +01:00