Commit Graph

5570 Commits

Author SHA1 Message Date
Fabien Potencier
aad2f5868a merged branch mvrhov/form_attributes_option (PR #1032)
Commits
-------

e8326aa Renamed attributes to attr to be consistent with templating.
c707467 Added support for additional attributes in Form types that list field as their parent.

Discussion
----------

[Form] Added support for additional attributes

Added support for additional attributes in Form types that list field as their parent.

This is needed particularity for html5 data and data- attributes support, unfortunately $options['data'] is already taken, so adding a general $options['attributes'] is the easiest solution without breaking BC.

Now I know that this will be tempting for some to stuck style and class attributes here also, but I'd rather not restrict the keys that are passed in.

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

by Seldaek at 2011/05/22 14:51:02 -0700

Maybe it should be called attr for consistency with the template stuff, or the other should be renamed attributes. Other than that, I'm +1, data-* attributes are awesome, and abusers will find ways to abuse things either way.

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

by mvrhov at 2011/05/22 21:48:01 -0700

Naming it attr also crossed my mind when I was signing off yesterday.
Along with the possibility to go the way xml attributes are handled when node is converted to/from array.
So every option with @ prefix would automatically become html attribute. However going the latter path, it'd be harder to implement.

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

by fabpot at 2011/06/13 07:43:52 -0700

Can you give an example of a real-world use case? Thanks.

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

by Seldaek at 2011/06/13 07:54:51 -0700

You can use `array('attr' => array('data-foo' => 'bar'))`, which will output `data-foo="bar"`, which can be read easily by jQuery for example as `$('el').data('foo')`. It's a standard compliant and elegant way to pass extra data needed by the JS code along with DOM nodes, without polluting everything with script tags and all.

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

by fabpot at 2011/06/13 08:01:08 -0700

@Seldaek: I understand that. But why not doing this in the template?

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

by Seldaek at 2011/06/13 08:04:10 -0700

Well, I agree it most likely belongs in the template, but it's kind of data stuff that is not directly impacting the display rules of the element, so in some cases having the possibility to set that from the php code might be useful. Anyway I'll let @mvrhov answer maybe he had a more concrete use case. I just think it's nice to leave the door open, but I don't really need it.

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

by mvrhov at 2011/06/13 10:27:03 -0700

A bit late to the party. Ok, here is my use-case.
I have a pretty large form where part of the data is of tabular form. The number of rows is almost every time a lot larger than the number of columns
So I can either output a lot of text inputs filled with data and make already a large form intimidating. Or I can use a grid that supports editing. So I serialize that tabular data as json and put it as a value into one hidden field. Somehow I also have to get the column definitions to that grid. I decided to I serialize it and put it inside data-* attribute. Putting it into another hidden field doesn't make sense as when data is submitted back I don't need the column definitions as only the number of rows changes.

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

by fabpot at 2011/06/13 10:44:58 -0700

@mvrhov: ok, but what prevents you from doing this in the template directly?

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

by mvrhov at 2011/06/13 11:22:53 -0700

I have to get it into the view somehow. What I'd really not like to do is, iterate through that data in a controller and then pass it as another template variable.

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

by fabpot at 2011/06/14 00:10:22 -0700

But the controller is where you prepare the data that you want to send to the view. Without any concrete example, I'm going to close this PR.

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

by mvrhov at 2011/06/14 01:21:10 -0700

IMHO this has to go out through form as this is the part of the form also I do have a very slim controllers in this case 10 LOC, where half of them is just setting up an view data..
Nonetheless I went looking again very closely at the AbstractType and I do have buildView function available which I can override and set the column data I need there, and then provide custom view for that, so at least from this part this is an non issue.

With this PR all default form attributes can be set from outside and when searching for a good use-case I have found out that @henrikbjorn has implemented this via extensions [1], maybe he has a good use-case for this.

[1] - https://github.com/Comways/ComwaysFormExtraBundle/blob/master/Form/Extension/FieldTypeExtension.php

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

by henrikbjorn at 2011/06/14 01:48:53 -0700

Convenience is the only use case

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

by stof at 2011/06/14 02:08:09 -0700

@fabpot The issue is that passing it from the controller as another template variable makes it really hard when you use the type twice with different values. Passing them from the form would be the easiest way

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

by shuogawa at 2011/06/14 19:37:50 -0700

hello. thanks for great form library.
I want to support two ways to display additional attributes for form elements.
1) control in template like
{{ form_row(form.name, { 'width': '30' }) }}
2) control from php
$builder->add('name', 'text', array('attr'=>array('width'=>'30')));

If form elements configure by end user like cms,
and form elements dynamically change.
The second method is useful.

template designer can write {{form_row(form)}}
but
template designer can not write {{form_row(form.name), { 'width': '30' }}}

Thank you

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

by fabpot at 2011/06/14 23:01:18 -0700

@shuogawa: That's what I fear. Setting the `width` or any other attribute in PHP is wrong. This belongs to the templates.

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

by stloyd at 2011/06/15 00:09:05 -0700

@fabpot Then maybe just restrict allowed tags to `data-*` and don't use `attr` but some other not confusing name ? Just like we do with i.e. `maxlength`.

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

by fabpot at 2011/06/15 04:44:25 -0700

I'm going to merge it as a "convenience" tool, but the documentation should clearly state that the only usage should be for `data-*` attributes.
2011-06-15 13:44:37 +02:00
Fabien Potencier
fb24b95bd5 made some tweaks to error levels 2011-06-15 13:04:19 +02:00
Fabien Potencier
8027eca3de fixed tests 2011-06-15 12:58:17 +02:00
Fabien Potencier
9e0d6177cb [Security] reverted some changes from previous merge 2011-06-15 12:35:09 +02:00
Fabien Potencier
8dbaf2aa38 [FrameworkBundle] removed unused variable 2011-06-15 12:33:17 +02:00
Fabien Potencier
01fcd7bdfd merged branch kaiwa/loglevel (PR #1073)
Commits
-------

cdf4b6a Checked log levels
a45d3ee Reverted last commit
529381b ControllerNotFound: Changed log level from info to error. Also moved throw exception code block up, to prevent the message from beeing logged multiple times.
7c29e88 Changed log level of "Matched route ..." message from info to debug
dca09fd Changed log level of "Using Controller ..." message from info to debug

Discussion
----------

Log levels

Just wanted to ask if the log level INFO is still correct for these messages?

As there are only four log levels left (DEBUG, INFO, WARNING, ERROR), DEBUG might be the more appropriate level for these messages now.

Let me give an example: An application is logging user actions (maybe to database) in order to assure comprehensibility, e. g. "User %s deleted post %d", "User %s written a message to user %s". These are not warnings of course, so the only suitable log level is INFO.
But they will be thrown together with these very common (at least two per request?) "Using controller..." and "Matched route..." messages when choosing INFO as log level.

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

by Seldaek at 2011/05/24 07:13:18 -0700

Agreed, this stuff is framework debug information.

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

by fabpot at 2011/05/24 08:53:24 -0700

Why do you want to change these two specific ones? The framework uses the INFO level at other places too. Is it a good idea to say that the framework only logs with DEBUG?

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

by stof at 2011/05/24 09:12:53 -0700

Doctrine logs at the INFO level too and I think it is useful to keep it as INFO. Being able to see the queries without having all DEBUG messages of the event dispatcher and security components is useful IMO.

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

by Seldaek at 2011/05/25 02:30:24 -0700

Yeah, that's true, maybe we just need to reintroduce (again, meh:) NOTICE between INFO and WARNING.

@kaiwa Of course the other way could be that you just add your DB handler to the app logger stack. That could be done in a onCoreRequest listener or such, basically you'd have to call `->pushHandler($yourDBHandler)` on the `monolog.logger.app` service. That way your messages will flow to it, but it won't receive noise from the framework stuff since those log on monolog.logger.request and other log channels.

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

by fabpot at 2011/05/25 02:48:26 -0700

@Seldaek: I don't think we need another level. We just need to come up with a standard rules about the usage of each level. Adapted from log4j:

* ERROR: Other runtime errors or unexpected conditions.
* WARN: Use of deprecated APIs, poor use of API, 'almost' errors, other runtime that are undesirable or unexpected, but not necessarily "wrong" (unable to write to the profiler DB, ).
* INFO: Interesting runtime events (security infos like the fact the user is logged-in or not, SQL logs, ...).
* DEBUG: Detailed information on the flow through the system (route match, security flow infos like the fact that a token was found or that remember-me cookie is found, ...).

What do you think?

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

by stloyd at 2011/05/25 02:53:38 -0700

+1 for this standard (also this PR can be merged then), but we should review code for other "wrong" log levels usage (if everyone accept this standard)

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

by fabpot at 2011/05/25 02:55:07 -0700

I won't merge this PR before all occurrences of the logger calls have been reviewed carefully and changed to the right level.

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

by kaiwa at 2011/05/25 02:58:44 -0700

@fabpot: Just noticed these two occurring for every request in my log file. You are right, there are other places where this changes must be applied if we will change the log level.

@stof: Hmm, i see. It is not possible to set the logger separately for each bundle, is it? That maybe would solve the problem. If somebody is interested in seeing the queries, he could set the log handler level to DEBUG for doctrine bundle, but still use INFO for the framwork itself. Plus he could even define a different output file or a completely different handler.

I'm not sure if something like that is possible already (?) or realizable at all... just came into my mind.

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

by Seldaek at 2011/05/25 03:01:07 -0700

Just FYI, from Monolog\Logger (which has CRITICAL and ALERT):

     * Debug messages
    const DEBUG = 100;

     * Messages you usually don't want to see
    const INFO = 200;

     * Exceptional occurences that are not errors
     * This is typically the logging level you want to use
    const WARNING = 300;

     * Errors
    const ERROR = 400;

     * Critical conditions (component unavailable, etc.)
    const CRITICAL = 500;

     * Action must be taken immediately (entire service down)
     * Should trigger alert by sms, email, etc.
    const ALERT = 550;

The values kind of match http error codes too, 4xx are expected errors that are not really important (404s etc) and 5xx are server errors that you'd better fix ASAP. I'm ok with the descriptions, but I think alert and critical should be included too. I'll probably update Monolog docblocks to match whatever ends up in the docs.

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

by Seldaek at 2011/05/25 03:03:21 -0700

@kaiwa you can do a lot, but not from the default monolog configuration entry, I'm not sure if we can really make that fully configurable without having a giant config mess. Please refer to my [comment above](https://github.com/symfony/symfony/pull/1073#issuecomment-1234316) to see how you could solve it. Maybe @fabpot has an idea how to make this more usable though.

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

by stof at 2011/05/25 03:19:43 -0700

@Seldaek the issue is that the different logging channels are only know in the compiler pass, not in the DI extension. So changing the level in the extension is really hard IMO.
Thus, the handlers are shared between the different logging channels (needed to open the log file only once for instance, or to send a single mail instead of one per channel) and the level is handled in the handlers, not the logger.

I'm +1 for the standard, by adding the distinction between 400 and 500 status calls using ERROR and CRITICAL (which is already the case in the code).

@kaiwa do you have time to review the calls to the logger between DEBUG and INFO or do you prefer I do it ? For instance, the Security component currently logs all message at DEBUG level and some of them should be INFO.

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

by kaiwa at 2011/05/25 04:31:04 -0700

@stof ok i'll do that

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

by kaiwa at 2011/05/25 12:22:51 -0700

Need some help :) I came across `ControllerNameParser::handleControllerNotFoundException()` which leads to redundant log messages currently:

>[2011-05-25 20:53:16] request.INFO: Unable to find controller "AppBaseBundle:Blog" - class "App\BaseBundle\Controller\BlogController" does not exist.

>[2011-05-25 20:53:16] request.ERROR: InvalidArgumentException: Unable to find controller "AppBaseBundle:Blog" - class "App\BaseBundle\Controller\BlogController" does not exist. (uncaught exception) at /home/ruth/symfony3/src/Symfony/Bundle/FrameworkBundle/Controller/ControllerNameParser.php line 87

Is it necessary to call `$this->logger->info($log);` if the InvalidArgumentException will be logged anyway?

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

by stof at 2011/05/25 12:39:22 -0700

Well, the issue is that the ControllerNameParser logs messages and then uses them to throw an exception. I guess the logging call should be removed as it is redundant with the one of the ExceptionListener. @fabpot thoughts ?

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

by kaiwa at 2011/05/27 11:39:25 -0700

I checked all debug, info and log calls. Sometimes it is hard to distinguish between the levels, so it would be great if someone reviews @cdf4b6a. @stof, maybe you want to take a look?

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

by kaiwa at 2011/05/31 12:52:07 -0700

@stof, thanks for your comments. I added some replies above, please let me know your suggestions.

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

by stof at 2011/05/31 14:04:22 -0700

@kaiwa As I said before, all the security logging calls should be DEBUG (most of them) or INFO (the one syaing that authentication succeeded for instance), but not WARN or ERROR as the exception don't go outside the firewall.
2011-06-15 12:31:31 +02:00
Fabien Potencier
52697ed3df [Swiftmailer] changed disable_strategy behavior
The blackhole plugin that was used previously stop the propagation
of events, which means that the behavior can be slightly different
depending on the order of plugin registrations.

Instead, we now use the null transport to avoid this issue.
2011-06-15 12:18:07 +02:00
Fabien Potencier
5b142d581b fixed CS 2011-06-15 11:35:32 +02:00
Fabien Potencier
e72ff4f43d merged branch umpirsky/request-doc-fix (PR #1328)
Commits
-------

cbd1dfd Minor doc fixes in Request.

Discussion
----------

Minor doc fixes in Request.

Minor fix, contribution warmup :)
2011-06-15 11:33:37 +02:00
Fabien Potencier
73dc8c96af merged branch vicb/form-proto (PR #1315)
Commits
-------

07fa82d [Form] Revert changes impacting perfomance and readability
b709551 [Order] Make Form::types and FormView::types use the same order (Parent > Child)
e56dad6 [Form] simplify the code
bdd755e [Form] Fix the exception message when no block is found
c68c511 [Form] Make theming form prototypes consistent (start by looking for a '_<id>_<section>' block)
9ec9960 [Form] Simplify the code
4e3e276 [Form] Make the prototype view child of the collection view

Discussion
----------

[Form] Make the prototype view child of the collection view

This PR should be a base for discussion.

The [current implementation](https://github.com/symfony/symfony/pull/1188) has some drawbacks because the prototype view is not a child of the collection view:

  * The 'multipart' attribute is not propagated from the prototype to the collection,
  * The prototype view do not use the theme from the collection.

Those 2 points are fixed by the proposed implementation and one more benefit is that the template markup might be easier to work with:

before:

```html
<div id="form_emails">
  <div>
    <label for="form_emails_0">0</label>
    <input type="email" id="form_emails_0" name="form[emails][0]" value="a@b.com">
  </div>
  <script type="text/html" id="form_emails_prototype">
    <div>
      <label for="$$name$$">$$name$$</label>
      <input type="email" id="$$name$$" name="$$name$$" value="" />
    </div>
  </script>
</div>
```
after:

```html
<div id="form_emails">
  <div>
    <label for="form_emails_0">0</label>
    <input type="email" id="form_emails_0" name="form[emails][0]" value="a@b.com">
  </div>
  <script type="text/html" id="form_emails_prototype">
    <div>
      <label for="form_emails_$$name$$">$$name$$</label>
      <input type="email" id="form_emails_$$name$$" name="form[emails][$$name$$]" value="" />
    </div>
  </script>
</div>
```

@kriswallsmith I'd like to get your feedback on this PR. thanks.

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

by stof at 2011/06/14 07:01:01 -0700

@fabpot any ETA about merging it ? Using the prototype currently is a pain to build the name. The change makes it far easier

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

by fabpot at 2011/06/14 07:09:46 -0700

The templates are much better but I'm a bit concerned that we need to add the logic into the Form class directly. That looks quite ugly. If there is no other way, I will merge it.

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

by vicb at 2011/06/14 07:14:32 -0700

I have found no better way... I am testing some minor tweaks I want to submit.

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

by kriswallsmith at 2011/06/14 07:34:25 -0700

I'm not happy with the code in Form.php either... would creating a PrototypeType accomplish the same thing?

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

by vicb at 2011/06/14 07:42:07 -0700

@kriswallsmith tried and dismissed, the id and name are bad & you have to go for `render_widget(form.get('proto'))` in the template. That should be fixeable but not any better.

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

by kriswallsmith at 2011/06/14 07:45:21 -0700

What do you mean the id and name are bad? If we have a distinct type for the prototype, can't we do whatever we want using buildView() and the template?

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

by vicb at 2011/06/14 07:53:31 -0700

@kriswallsmith the id would be smthg like `form_emails_$$name$$_prototype` but yes we should be able to do whatever we want but the code might end up being more complex.

I am done with the tweaks but still open to feedback on this PR.

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

by kriswallsmith at 2011/06/14 08:08:21 -0700

Yes, that is the type of name I would expect.

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

by kriswallsmith at 2011/06/14 08:08:33 -0700

Oops -- I mean id.

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

by kriswallsmith at 2011/06/14 08:09:42 -0700

Maybe I'm confused what id you're referring to. I'll try to spend some time on this today.

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

by vicb at 2011/06/14 08:23:56 -0700

That should be the id of the `<input>`, the id of the script would be `form_emails_$$name$$_prototype_prototype` (if prototype is the name of the nested node).

I am trying to setup a branch with my code (playing with git & netbeans local history)

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

by vicb at 2011/06/14 08:46:25 -0700

@kriswallsmith https://github.com/vicb/symfony/tree/kris/proto if that can help (there are still changes in Form.php)

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

by kriswallsmith at 2011/06/14 08:47:08 -0700

Thanks, I'll take a look.

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

by vicb at 2011/06/15 00:48:38 -0700

I would have expected it to be faster however `array_map` is about twice slower... reverted !
2011-06-15 11:27:12 +02:00
Fabien Potencier
168a61b9ea [Form] fixed typo (patch from mgatto) 2011-06-15 11:25:50 +02:00
Victor Berchet
07fa82dff1 [Form] Revert changes impacting perfomance and readability 2011-06-15 09:45:11 +02:00
Fabien Potencier
46a93c376c [Routing] optimized PHP dumper when the parent prefix is the same for several adjacent collections (avoids the same test to be made) 2011-06-15 09:36:36 +02:00
Fabien Potencier
1438f6be04 [Routing] added some unit tests for latest merge (and fixed a bug ;)) 2011-06-15 09:22:10 +02:00
Fabien Potencier
c8df0ccf79 merged branch lmcd/master (PR #1290)
Commits
-------

49dd558 Couple more CS fixes
5a986bf Add $keysCount & minor CS fix
91f4097 [Routing] Better nesting for RouteCollections in dumped URL matcher classes With this change, a route prefixed with '/blogger' will be nested inside '/blog' (for example)

Discussion
----------

[Routing] Better nesting for RouteCollections in dumped URL matcher classes

Consider the following routing file:

    _blog:
        resource: "@AcmeDemoBundle/Resources/config/routing/BlogController.yml"
        prefix:   /blog

    _blogger:
        resource: "@AcmeDemoBundle/Resources/config/routing/BloggerController.yml"
        prefix:   /blogger

    _bloggeroo:
        resource: "@AcmeDemoBundle/Resources/config/routing/BloggerooController.yml"
        prefix:   /bloggeroo

    _blogtest:
        pattern:   /blogtest
        defaults:  { _controller: AcmeDemoBundle:Blog:test }

    login:
        pattern:   /login
        defaults:  { _controller: AcmeDemoBundle:Security:login }

Note: Each imported file contains two simple blog/blogger/bloggeroo routes (e.g. blog_index & blog_view)
With this change, the cached URL matcher looks something like this:

```php
<?php
class appprodUrlMatcher
{
  public function match($pathinfo)
  {
      $allow = array();

      if (0 === strpos($pathinfo, '/blog')) {
          // blog_index
          if (preg_match('#^/blog/(?P<slug>[^/]+?)$#x', $pathinfo, $matches)) {...}

          // blog_view
          if (preg_match('#^/blog/(?P<year>\d{4})/(?P<month>\d{2})/(?P<slug>[^/]+?)$#x', $pathinfo, $matches)) {...}

          if (0 === strpos($pathinfo, '/blogger')) {
              // blogger_index
              if (preg_match('#^/blogger/(?P<slug>[^/]+?)$#x', $pathinfo, $matches)) {...}

              // blogger_view
              if (preg_match('#^/blogger/(?P<year>\d{4})/(?P<month>\d{2})/(?P<slug>[^/]+?)$#x', $pathinfo, $matches)) {...}

              if (0 === strpos($pathinfo, '/bloggeroo')) {
                  // bloggeroo_index
                  if (preg_match('#^/bloggeroo/(?P<slug>[^/]+?)$#x', $pathinfo, $matches)) {...}

                  // bloggeroo_view
                  if (preg_match('#^/bloggeroo/(?P<year>\d{4})/(?P<month>\d{2})/(?P<slug>[^/]+?)$#x', $pathinfo, $matches)) {...}

                  throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException();
              }

              throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException();
          }

          // _blogtest
          if ($pathinfo === '/blogtest') {...}

          throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException();
      }

      // login
      if ($pathinfo === '/login') {...}

      throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException();
  }
}
```

As far as I can see, you can throw the 404 earlier (as I've done), as by nesting all these possibilities, there is no chance another route will be matched outside the parent if statement.

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

by stloyd at 2011/06/11 08:37:15 -0700

You should follow Symfony [CS rules] (http://symfony.com/doc/current/contributing/code/standards.html), also you should modify tests.

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

by lmcd at 2011/06/11 08:46:32 -0700

Besides the inline `continue` statement, I can't see spot any other CS violations. I'm on to the updated tests.

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

by fabpot at 2011/06/13 02:19:14 -0700

What if you have this:

    _blog:
        resource: "@AcmeDemoBundle/Resources/config/routing/BlogController.yml"
        prefix:   /blog

    login:
        pattern:   /login
        defaults:  { _controller: AcmeDemoBundle:Security:login }

    _blogger:
        resource: "@AcmeDemoBundle/Resources/config/routing/BloggerController.yml"
        prefix:   /blogger

You cannot send 404 early because the same `blog` prefix is used in two different places. I can see many things that will break with this patch. I'm pretty sure we can enhance the performance of the existing code but let's do that after 2.0.

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

by lmcd at 2011/06/13 05:04:03 -0700

@fabpot: The code was designed so it would work in these kind of circumstances. I ran the dumper against the routing file you provided and this is the output below.

I see no reason why you can't throw the 404 earlier, as by nesting everything with similar prefixes, we're eliminating the possibility that a route will ever be matched outside of that if statement.

```php
public function match($pathinfo)
{
    $allow = array();

    if (0 === strpos($pathinfo, '/blog')) {
        // blog_index
        if (preg_match('#^/blog/(?P<slug>[^/]+?)$#x', $pathinfo, $matches)) {
            ...
        }

        // blog_view
        if (preg_match('#^/blog/(?P<year>\d{4})/(?P<month>\d{2})/(?P<slug>[^/]+?)$#x', $pathinfo, $matches)) {
            ...
        }

        if (0 === strpos($pathinfo, '/blogger')) {
            // blog_index
            if (preg_match('#^/blogger/(?P<slug>[^/]+?)$#x', $pathinfo, $matches)) {
                ...
            }

            // blog_view
            if (preg_match('#^/blogger/(?P<year>\d{4})/(?P<month>\d{2})/(?P<slug>[^/]+?)$#x', $pathinfo, $matches)) {
                ...
            }

            throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException();
        }

        throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException();
    }

    // login
    if ($pathinfo === '/login') {
        ...
    }

    throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException();
}
```

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

by fabpot at 2011/06/13 07:48:49 -0700

Can you add some more tests to ensure that everything works fine and that we won't have regressions later on? Thanks.
2011-06-15 09:09:35 +02:00
Fabien Potencier
a29bdfef28 merged branch dlsniper/openbasedir-enhancement (PR #1326)
Commits
-------

e718474 fixed CS and unsude variable (PR #1319)
b552354 Executable Finder will now try to match if a file is already in the open_basedir list before searching it thru that list

Discussion
----------

open_basedir exhancements for Executable Finder

I've made the some changed to the Executable Finder in order to handle the open_basedir ability to specify files in the list not just directories.

This should fix symfony/symfony#1319

Hope I didn't made any CS violations.
2011-06-15 09:05:19 +02:00
Fabien Potencier
c5223bbcd1 merged branch vicb/file (PR #1317)
Commits
-------

9d6357c [HttpFoundation] Document the changes to the File classes
136b80a [HttFoundation] Add File::getExtension() as \SplFileInfo::getExtension() was introduced in PHP 5.3.6
38b3b74 [HttpKernel] Fix and test previous commit
ac0c00c [HttpFoundation] Make File extends \SplFileInfo

Discussion
----------

[HttpFoundation] Make File extends \SplFileInfo

This is a rebased version of [PR 674](https://github.com/symfony/symfony/pull/674).

  * File: The API has changed (now extends \SplFileInfo),
  * File: move() creates the target directory when it does not exist
  * UploadedFile: introduction of getClientXXX() methods (for Size, OriginalName, MimeType)

If this PR does not get merged UploadedFile should at least be fixed: [Client.php](https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpKernel/Client.php#L124) relies on a last parameter which is no more defined and which is used to bypass [move_uploaded_file()](https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpFoundation/File/UploadedFile.php#L155) in test mode.

If this could be merged, I'll detail the changes in UPDATE.md

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

by fabpot at 2011/06/14 08:20:59 -0700

I'll merge it. Can you update the UPDATE file?

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

by vicb at 2011/06/14 09:24:01 -0700

done
2011-06-15 08:57:16 +02:00
Fabien Potencier
398c86d063 merged branch vicb/httpkernel/fix-test (PR #1330)
Commits
-------

5069fe2 [HttpKernel] Fix randomly failing tests

Discussion
----------

[HttpKernel] Fix randomly failing tests

Response time comparison causes tests to fail randomly.

```

1) Symfony\Tests\Component\HttpKernel\HttpKernelTest::testHandleWhenNoControllerIsAStaticArray
Failed asserting that two objects are equal.
--- Expected
+++ Actual
@@ @@
                         (
-                            [0] => Tue, 14 Jun 2011 19:56:20 GMT
+                            [0] => Tue, 14 Jun 2011 19:56:21 GMT
                         )
```

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

by stloyd at 2011/06/14 15:37:11 -0700

+1 this sometimes occurs when running all tests.
2011-06-15 07:57:02 +02:00
Fabien Potencier
af97610ee6 [CssSelector] renamed Parser::cssToXPath() to CssSelector::toXPath() 2011-06-15 07:55:23 +02:00
Victor Berchet
b709551252 [Order] Make Form::types and FormView::types use the same order (Parent > Child) 2011-06-15 01:45:26 +02:00
Victor Berchet
e56dad6b5e [Form] simplify the code 2011-06-15 01:41:37 +02:00
Victor Berchet
5069fe2cf2 [HttpKernel] Fix randomly failing tests 2011-06-14 22:30:49 +02:00
Fabien Potencier
783f1679b9 fixed autoloader when Swiftmailer is not installed 2011-06-14 21:57:58 +02:00
Sasa Stamenkovic
cbd1dfd3bd Minor doc fixes in Request. 2011-06-14 21:44:45 +02:00
Florin Patan
e718474873 fixed CS and unsude variable (PR #1319) 2011-06-14 14:05:40 -04:00
Florin Patan
b552354414 Executable Finder will now try to match if a file is already in the open_basedir list before searching it thru that list 2011-06-14 13:36:01 -04:00
Victor Berchet
9d6357c35b [HttpFoundation] Document the changes to the File classes 2011-06-14 18:21:04 +02:00
Victor Berchet
136b80ae63 [HttFoundation] Add File::getExtension() as \SplFileInfo::getExtension() was introduced in PHP 5.3.6 2011-06-14 18:18:43 +02:00
Victor Berchet
bdd755e45b [Form] Fix the exception message when no block is found 2011-06-14 16:45:03 +02:00
Victor Berchet
c68c511388 [Form] Make theming form prototypes consistent (start by looking for a '_<id>_<section>' block) 2011-06-14 16:36:31 +02:00
Victor Berchet
9ec99608df [Form] Simplify the code 2011-06-14 16:30:48 +02:00
Fabien Potencier
06614cd6ca [Yaml] moved exceptions to their own sub-namespace (added a specific exception for the dump) 2011-06-14 16:25:26 +02:00
Fabien Potencier
a9dab719df [Yaml] removed support for YAML 1.1 spec 2011-06-14 16:25:25 +02:00
Fabien Potencier
3859589daa [Yaml] renamed load() to parse() 2011-06-14 16:25:25 +02:00
Fabien Potencier
9b1b9373b8 [HttpFoundation] simplified code 2011-06-14 16:08:07 +02:00
Fabien Potencier
24778553cd [HttpFoundation] simplified code 2011-06-14 16:07:18 +02:00
Fabien Potencier
b763d667f5 merged branch lsmith77/checkIp (PR #1322)
Commits
-------

2f04bdb make checkIp() reuseable

Discussion
----------

[RequestMatcher] make checkIp() reuseable
2011-06-14 15:59:49 +02:00
Fabien Potencier
ddb0a8559d [AsseticBundle] fixed unit tests 2011-06-14 15:53:30 +02:00
Fabien Potencier
e5ccaabefd merged branch kriswallsmith/assetic/cssembed-config (PR #1321)
Commits
-------

ee8f34e [AsseticBundle] added more cssembed config options (closes #1249)

Discussion
----------

[AsseticBundle] added more cssembed config options (closes #1249)
2011-06-14 15:45:31 +02:00
Fabien Potencier
be3587d165 merged branch kriswallsmith/assetic/lazy-finder (PR #1320)
Commits
-------

4016dfb [AsseticBundle] moved ExecutableFinder back into a closure so it's only called if needed

Discussion
----------

[AsseticBundle] moved ExecutableFinder back into a closure

[AsseticBundle] moved ExecutableFinder back into a closure so it's only called if needed

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

by fabpot at 2011/06/14 05:46:14 -0700

Does it relate to #1319?

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

by kriswallsmith at 2011/06/14 05:47:25 -0700

It's related, yes, but I don't think it's a solution for the issue.

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

by dlsniper at 2011/06/14 06:00:55 -0700

The issue in #1319 has been fixed with this: 0d54f5c21e
It's in the latest master tree but finding that file only when needed is also a good idea.
2011-06-14 15:45:17 +02:00
Fabien Potencier
397fad3810 [Routing] added missing public @api 2011-06-14 15:40:43 +02:00
Fabien Potencier
72483f946b [Routing] tagged the public @api 2011-06-14 15:35:32 +02:00
Lukas Kahwe Smith
2f04bdb3c5 make checkIp() reuseable 2011-06-14 15:31:52 +02:00
Fabien Potencier
59301a93d7 [ClassLoader] tweaked public @api 2011-06-14 15:20:59 +02:00
Fabien Potencier
54e054b2d1 [DomCrawler] tweaked public @api 2011-06-14 15:16:43 +02:00
Kris Wallsmith
ee8f34e7ed [AsseticBundle] added more cssembed config options (closes #1249) 2011-06-14 05:48:51 -07:00
Fabien Potencier
dd23402e94 [EventDispatcher] tweaked public @api 2011-06-14 14:40:48 +02:00
Fabien Potencier
c6cc427e4b [EventDispatcher] added a way to set the priority for event subscribers 2011-06-14 14:40:27 +02:00
Fabien Potencier
b76a1c3077 [Finder] added a convenience method Finder::create() 2011-06-14 14:18:24 +02:00
Fabien Potencier
1ad5bfd723 [CssSelector] renamed SyntaxError 2011-06-14 14:12:03 +02:00