Commit Graph

7834 Commits

Author SHA1 Message Date
Jakub Zalas
bba0080560 [Filesystem] Added unit tests for remove method. 2012-04-06 20:38:21 +01:00
Jakub Zalas
8e861b746a [Filesystem] Introduced workspace directory to limit complexity of tests. 2012-04-06 19:59:25 +01:00
Kim Hemsø Rasmussen
7e66908c02 Added XCache class loader 2012-04-06 20:32:52 +02:00
Jeremy Mikola
1c3e4ac694 [DependencyInjection] Fix Yaml file loader test
This broke when 2.0 was recently merged into master with b9daae2847, as the Yaml fixture change from 24a0d0a2dc was not included.
2012-04-06 14:29:48 -04:00
Jakub Zalas
a91e200db7 [Filesystem] Added unit tests for touch method. 2012-04-06 19:22:22 +01:00
Jakub Zalas
7e297dbead [Filesystem] Added unit tests for mkdir method. 2012-04-06 19:10:23 +01:00
Bernhard Schussek
658472193d [Form] Improved labels generated by default from form names 2012-04-06 19:50:06 +02:00
Bernhard Schussek
6e0b03a6e2 [Form] Fixed label of prototype in CollectionType 2012-04-06 19:45:42 +02:00
Bernhard Schussek
fc342d1a5b Merge remote branch 'umpirsky/collection-name' into issue3738 2012-04-06 19:34:40 +02:00
Jakub Zalas
6ac5486672 [Filesystem] Added unit tests for copy method. 2012-04-06 17:48:54 +01:00
Jakub Zalas
1c833e7d78 [Filesystem] Added missing docblock comment. 2012-04-06 17:48:01 +01:00
Jordi Boggiano
7ce22f0cef [Console] Add docblocks 2012-04-06 18:25:51 +02:00
Fabien Potencier
20a9961711 merged branch jjbohn/feature/property-path-hasser (PR #3549)
Commits
-------

b6ac1aa [FORM] Give PropertyPath ability to read hassers

Discussion
----------

[Form] Give PropertyPath ability to read hassers

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

Using a `hasser` instead of `isser` for Boolean values is pretty common. I've found myself using `issers` a handful of times just to make an interface play nice with the form component, but the code reads funny now. I don't think we should be accounting for every possible `getter` variation, but I think this one is common enough that it warrants a discussion.

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

by fabpot at 2012-03-11T08:25:31Z

I tend to agree with with. What do you think @bschussek?

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

by kriswallsmith at 2012-03-16T22:42:28Z

I'm not so sure. There are lots of reasons to write a *hasser* that accepts an argument (i.e. `User::hasRole($role)`). Doesn't seem as clean as *issers* and *getters*.

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

by vicb at 2012-03-16T22:49:14Z

> There are lots of reasons to write a hasser that accepts an argument

May be can check for 0 args as we are already using reflexion ?

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

by kriswallsmith at 2012-03-16T22:55:43Z

In that case we should check that there are either 0 arguments or only optional arguments and also consider adding the same logic to the other varieties.

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

by jjbohn at 2012-03-16T23:37:47Z

Passing arguments seems like a pretty big departure for PropertyPath. How would you annotate that? I'm not sure I see a common use case for needing arguments when mapping data to and from forms.

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

by stof at 2012-03-16T23:50:22Z

@jjbohn it is not about passing arguments but about using the hasser only if it does not have required arguments

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

by jjbohn at 2012-03-17T01:54:18Z

Ah. I see. I have a tendency to read @kriswallsmith comments wrong :D. I could see that but iirc, there's not any current check like this on the other accessors. Happy to add it though if there's a consensus.

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

by fabpot at 2012-03-17T11:24:34Z

What's the point is checking the hasser/getter/isser arguments. It's up to the developer to check if he can use them or not. Let's not complexify the code for this.

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

by kriswallsmith at 2012-03-17T15:37:39Z

My concern is that someone writes a hasser method on their model that is not intended for use with the form component but it's called anyway, leading to WTFs.

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

by stof at 2012-04-03T22:28:21Z

@fabpot what's your decision about this ?

@jjbohn you need to rebase your PR. It conflicts with master as tests have been moved

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

by bschussek at 2012-04-05T14:53:55Z

@kriswallsmith is right. The check for 1 === $method->getNumberOfRequiredParameters() can (and should) easily be added to all of the if-clauses here.

Apart from that, I'm okay with adding this.
2012-04-06 15:09:38 +02:00
Fabien Potencier
85535de74b moved a fixture file 2012-04-06 14:27:17 +02:00
Fabien Potencier
245a7b7eec merged branch ruimarinho/icu-48-fix (PR #3748)
Commits
-------

8689e9c [WIP] [Locale] Fixes NumberFormatter tests failing when using ICU 4.8 or 4.8.1

Discussion
----------

[WIP] [Locale] Fixes NumberFormatter tests failing when using ICU 4.8 or 4.8.1.1

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

The ICU CLDR 2.0 data has been updated on ICU 4.8 and the same data set is used on version 4.8.1.1. The problem is related to [this commit](http://bugs.icu-project.org/trac/changeset?reponame=&new=31307%40icu%2Ftrunk%2Fsource%2Fdata%2Fcurr%2Fen.txt&old=31074%40icu%2Ftrunk%2Fsource%2Fdata%2Fcurr%2Fen.txt) which has since been updated with new data and subsequently shipped with version 49.

The `DateFormatter` tests are still failing - see this [gist](https://gist.github.com/2004d40e5167286028ea). Suggestions are welcomed on how to handle this part.

Test results with PHP 5.4.0 with ICU 4.8.1.1 on OSX:

````
FAILURES!
Tests: 5917, Assertions: 12749, Failures: 26, Incomplete: 11, Skipped: 47.
```

with this WIP patch:

```
FAILURES!
Tests: 5917, Assertions: 12749, Failures: 13, Incomplete: 11, Skipped: 47.
```
2012-04-06 14:24:19 +02:00
Fabien Potencier
1387415ec3 merged branch hhamon/route_collection_better_exception_message (PR #3801)
Commits
-------

04ae7cc [Routing] fixed exception message.
f7647f9 [Routing] improved exception message when giving an invalid route name.

Discussion
----------

Route collection better exception message

Bug fix: no
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: -
Todo: -
2012-04-06 14:22:10 +02:00
Fabien Potencier
b9daae2847 merged 2.0 2012-04-06 14:21:18 +02:00
Fabien Potencier
f2398f61a6 merged branch Seldaek/console_ex_20 (PR #3802)
Commits
-------

595cc11 [Console] Wrap exception messages to the terminal width to avoid ugly output
97f7b29 [Console] Avoid outputing \r's in exception messages

Discussion
----------

[Console] Exception rendering fixes

This fixes two things:

- `\r`'s in exception messages were output (in case of `\r\n` newlines), creating really weird results on windows.
- long exception messages were wrapping and then the "red" block was completely messed up, with half black/half red lines, now it's wrapped before output if the terminal width can be detected.

If you don't care about merging this for 2.0, you can also merge the `console_ex` branch which applies on master. Due to moving tests and renaming of some normalize stuff in the tests, the two test patches are kind of different.

RFC: I am really not sure where to put those getTerminalWidth/Height methods. I guess this is not the best place.
2012-04-06 14:15:48 +02:00
Fabien Potencier
37c9fe9a2b merged branch Seldaek/validator_yaml (PR #3794)
Commits
-------

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

Discussion
----------

[Validator] Allow empty keys in the validation config

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

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

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

Could you add a test please?

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

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

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

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

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

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

d04638a [EventDispatcher] More logical positions for classes.

Discussion
----------

[EventDispatcher] More logical positions for classes.

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

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

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

ah sorry, I looked at the patch too fast. Only the interface is moved
2012-04-05 08:11:42 +02:00
excelwebzone
bec2f0f70a Fix hebrew grammar 2012-04-04 19:12:09 -07:00
excelwebzone
1b48abbfa2 Hebrew translation update 2012-04-04 19:07:45 -07:00
Drak
d04638a9b5 [EventDispatcher] More logical positions for classes. 2012-04-04 22:03:00 +05:45
Christophe Coevoet
a2f65f7dfa [FrameworkBundle] Added the translation file for the en locale
This fixes the translation when the fallback is set to another language.
This new file can be used as reference by translators to find missing keys
in their translations as every contributor will be able to update it when
adding new keys.
2012-04-04 17:23:03 +02:00
John Bohn
b6ac1aa912 [FORM] Give PropertyPath ability to read hassers 2012-04-04 09:49:16 -05:00
Thomas Chmielowiec (chmielot)
a430f3d8a6 [#3446] [Form] Fix getChoicesForValues of EntityChoiceList on empty values 2012-04-04 15:46:22 +02:00
Rui Marinho
fc41d4f223 [Security] [HttpDigest] Fixes a configuration error caused by an invalid 'key' child node configuration 2012-04-04 14:28:24 +01:00
Fabien Potencier
e4ebffb01b Revert "merged branch ruimarinho/http_digest (PR #3778)"
This reverts commit eb6a26f572, reversing
changes made to a10fee16c1.
2012-04-04 13:13:39 +02:00
Fabien Potencier
eb6a26f572 merged branch ruimarinho/http_digest (PR #3778)
Commits
-------

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

Discussion
----------

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

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

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

Discussion
----------

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

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

1456e1e Polish translations sync

Discussion
----------

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

b5de295 Slovak translation update

Discussion
----------

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

2519544 slovenian translations updated to latest list

Discussion
----------

Slovenian translations updated to latest list

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

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

Discussion
----------

[Console] Fixes formatter nested style appliance.

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

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

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

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

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

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

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

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

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

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

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

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

Discussion
----------

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

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

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

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

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

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

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

Expiration might look something like this:

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

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

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

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

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

@fabpot I have removed [WIP] status.

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

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

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

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

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

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

56c1e31 performance improvement in PhpMatcherDumper

Discussion
----------

performance improvement in PhpMatcherDumper

Tests pass: yes

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

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

Discussion
----------

Autoloader refactoring

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

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

```php
<?php

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

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

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

$loader->register();
```

Differences with the composer class loader:

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

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

```php
<?php

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

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

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

TODO:

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

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

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

Can you update the CHANGELOG and the UPGRADE file accordingly?

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

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

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

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

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

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

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

dbab7e1 [TwigBridge] Added a TwigEngine in the bridge

Discussion
----------

[TwigBridge] Added a TwigEngine in the bridge

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

This will allow people to support the PhpEngine and Twig in their code more easily when using the component as they don't need to reimplement the class.
I originally thought about when I helped @dragoonis to integrate the Templating component in the PPI framework 2.0 as he talked about adding the support for Twig later too.
2012-04-02 19:06:44 +02:00
Christophe Coevoet
f5cb167554 [ClassLoader] Added a DebugClassLoader using composition 2012-04-02 19:03:58 +02:00
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