This project is archived and is in readonly mode.

#2427 ✓stale
Andreas Gerauer

verify always loads session

Reported by Andreas Gerauer | April 5th, 2009 @ 11:20 PM | in 3.x

Scince Rails 2.3 the session is lazy loaded the first time it is accessed.

The verify instruction in Rails 2.3.2 is accessing always accessing the session, even if the user does not specify any session relevant options.

Consider the following example:


class TestController < ApplicationController
  verify :params => 'one'

  def index
    render :nothing
  end
end

As there is no reference to the session, it should not be loaded if the index action is called. However the current implementation of verify will access a session with a key of nil.

The attached patch prevents this access and therefore prevents the unneeded loading of the current session. A small addition in ActionController::TestSession will raise an exception if someone tries to read the nil key from it. I think this is the easiest way to test this behaviour.

This is my first contribution, as such I'd appreciate any feedback. Would it be possible to integrate this patch in the next 2.3 release?

Comments and changes to this ticket

  • Jeremy Kemper

    Jeremy Kemper May 4th, 2010 @ 06:48 PM

    • Milestone changed from 2.x to 3.x
  • Surendra Singhi

    Surendra Singhi May 26th, 2010 @ 07:39 PM

    +1 for this patch. This is an annoying problem.

  • Surendra Singhi

    Surendra Singhi May 26th, 2010 @ 07:42 PM

    • Tag changed from 2.3.2, bug, load, patch, session, verify to 2.3.x, bug, load, patch, session, verify
  • Santiago Pastorino

    Santiago Pastorino February 2nd, 2011 @ 04:52 PM

    • State changed from “new” to “open”
    • Tag changed from 2.3.x, bug, load, patch, session, verify to 23x, bug, load, patch, session, verify
    • Importance changed from “” to “”

    This issue has been automatically marked as stale because it has not been commented on for at least three months.

    The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.

    Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.

  • Santiago Pastorino

    Santiago Pastorino February 2nd, 2011 @ 04:52 PM

    • State changed from “open” to “stale”
  • klkk

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Attachments

Referenced by

Pages